yes light does not have a mass.but here the formula E=mc^2 .here the mass is not related to the mass of light.here the rest mass m is used of that particle or object which is converted to the energy E . if we multiply m with c^2 then we get that converted energy.