  We prove that if positive integer p-surgery along a knot K \subset S^3
produces an L-space and it bounds a sharp 4-manifold, then the knot genus obeys
the bound 2g(K) -1 \leq p - \sqrt{3p+1}. Moreover, there exists an infinite
family of pairs (K_n,p_n) attaining this bound, where K_n denotes an n-fold
iterated cable of the unknot and p_n \to \infty. In particular, the stated
bound applies when the knot surgery produces a lens space or a connected sum
thereof. Combined with work of Gordon-Luecke, Hoffman, and Matignon-Sayari, it
follows that if surgery along a knot produces a connected sum of lens spaces,
then the knot is either a torus knot or a cable thereof, confirming the cabling
conjecture in this case.
