linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Coverity: encode_cb_recallany4args(): Error handling issues
@ 2022-11-18 17:00 coverity-bot
  2022-11-18 18:01 ` Chuck Lever III
  0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2022-11-18 17:00 UTC (permalink / raw)
  To: Dai Ngo
  Cc: linux-kernel, Jeff Layton, Chuck Lever, linux-nfs,
	Gustavo A. R. Silva, linux-next, linux-hardening

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@chromium.org>
Addresses-Coverity-ID: 1527365 ("Error handling issues")
Fixes: 32dce0f9611b ("NFSD: add support for sending CB_RECALL_ANY")

Thanks for your attention!

-- 
Coverity-bot

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Coverity: encode_cb_recallany4args(): Error handling issues
  2022-11-18 17:00 Coverity: encode_cb_recallany4args(): Error handling issues coverity-bot
@ 2022-11-18 18:01 ` Chuck Lever III
  0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever III @ 2022-11-18 18:01 UTC (permalink / raw)
  To: Dai Ngo
  Cc: LKML, Jeff Layton, Linux NFS Mailing List, Gustavo A. R. Silva,
	Linux Next Mailing List, linux-hardening, coverity-bot



> On Nov 18, 2022, at 12:00 PM, coverity-bot <keescook@chromium.org> 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@chromium.org>
> 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-18 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 17:00 Coverity: encode_cb_recallany4args(): Error handling issues coverity-bot
2022-11-18 18:01 ` Chuck Lever III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).