Dear Student,
If the magnification produced by the convex lens is negative, the image will be real and inverted. It is because if the magnification produced by a lens has a negative value, the image is always real and inverted.
In the case of convex mirror, image always formed behind the mirror, thus the distance of image is taken as positive.
Regards