[remark for v2] I began by considering curves in v1. I am convinced that the answer is positive. Thanks to Jason Starr and abx.

Let $X$ be a complex projective variety.

Let $K_X$ be its canonical bundle.

Let $m$ be an integer.

We assume that a generic element in the linear system $|mK_X|$ is a smooth divisor.

Let $S\subseteq|mK_X|$ be the set of singular divisors.

Is $S$ always a hypersurface, i.e., without irreducible component of codimension $\geqslant 2$ ?

If it is the case, could we calculate the degree of $S$ ?