Sign Convention

For lenses, The side of the lens where the object is positive for objects but negative for images. A positive image distance means the image is on the other side of the lens, because that's the side where the light goes.

f, the focal length, is positive for a converging object (concave mirror or convex lens), and negative for a diverging object (convex mirror or concave lens).

When the image distance is positive, the image is on the side where the light is (the object side for mirrors but the opposite side for lenses), and it is real and inverted. When the image distance is negative, the image is on the negative side, so the image is virtual and upright.

A negative m means that the image is inverted. Positive means an upright image.