A remark on the computation of the gravitational potential of masses with linearly varying density