Re: Coverity: encode_cb_recallany4args(): Error handling issues

From: Chuck Lever III
Date: Fri Nov 18 2022 - 13:02:16 EST




> On Nov 18, 2022, at 12:00 PM, coverity-bot <keescook@xxxxxxxxxxxx> wrote:
>
> Hello!
>
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20221118 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
>
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
>
> Thu Nov 17 11:55:28 2022 -0500
> 32dce0f9611b ("NFSD: add support for sending CB_RECALL_ANY")
>
> Coverity reported the following:
>
> *** CID 1527365: Error handling issues (CHECKED_RETURN)
> fs/nfsd/nfs4callback.c:344 in encode_cb_recallany4args()
> 338 */
> 339 static void
> 340 encode_cb_recallany4args(struct xdr_stream *xdr,
> 341 struct nfs4_cb_compound_hdr *hdr, struct nfsd4_cb_recall_any *ra)
> 342 {
> 343 encode_nfs_cb_opnum4(xdr, OP_CB_RECALL_ANY);
> vvv CID 1527365: Error handling issues (CHECKED_RETURN)
> vvv Calling "xdr_stream_encode_u32" without checking return value (as is done elsewhere 23 out of 24 times).
> 344 xdr_stream_encode_u32(xdr, ra->ra_keep);
> 345 xdr_stream_encode_uint32_array(xdr, ra->ra_bmval,
> 346 ARRAY_SIZE(ra->ra_bmval));
> 347 hdr->nops++;
> 348 }
> 349
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
>
> Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
> Addresses-Coverity-ID: 1527365 ("Error handling issues")
> Fixes: 32dce0f9611b ("NFSD: add support for sending CB_RECALL_ANY")
>
> Thanks for your attention!

My fault. I removed the WARN_ON_ONCE() wrappers, which are clutter
(though they are clutter that is already used elsewhere).

I will update linux-next with a fix.


--
Chuck Lever