In the solution to problem 1.211 I have already computed the gravitational flux outside a uniform sphere and I shall not repeat it here. Please consult 1.211 for this part of the problem. In this solution I shall only consider the flux and potential inside the sphere.
The area vector dA at any point on this Gaussian surface will also be directed radially (collinear with g).
The total mass contained within a Gaussian sphere of radius r will be
Now the potential at a point r is given by,