linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: "Darrick J. Wong" <darrick.wong@oracle.com>,
	Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] libfrog: fix a potential null pointer dereference
Date: Thu, 8 Oct 2020 15:16:56 -0500	[thread overview]
Message-ID: <05af96e6-aab8-3a93-93f5-6cb9195f50cb@sandeen.net> (raw)
In-Reply-To: <20201008035732.GA6535@magnolia>

On 10/7/20 10:57 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Apparently, gcc 10.2 thinks that it's possible for either of the calloc
> arguments to be zero here, in which case it will return NULL with a zero
> errno.  I suppose it's possible to do that via integer overflow in the
> macro, though I find it unlikely unless someone passes in a yuuuge value.
> 
> Nevertheless, just shut up the warning by hardcoding the error number
> so I can move on to nastier bugs.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  libfrog/bulkstat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libfrog/bulkstat.c b/libfrog/bulkstat.c
> index c3e5c5f804e4..195f6ea053bd 100644
> --- a/libfrog/bulkstat.c
> +++ b/libfrog/bulkstat.c
> @@ -428,7 +428,7 @@ xfrog_bulkstat_alloc_req(
>  
>  	breq = calloc(1, XFS_BULKSTAT_REQ_SIZE(nr));
>  	if (!breq)
> -		return -errno;
> +		return -ENOMEM;

Sure, why not!

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
 
>  	breq->hdr.icount = nr;
>  	breq->hdr.ino = startino;
> 

  reply	other threads:[~2020-10-08 20:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  3:57 [PATCH] libfrog: fix a potential null pointer dereference Darrick J. Wong
2020-10-08 20:16 ` Eric Sandeen [this message]
2020-10-15  8:26 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05af96e6-aab8-3a93-93f5-6cb9195f50cb@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).