public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] libfrog: fix a potential null pointer dereference
Date: Wed, 7 Oct 2020 20:57:32 -0700	[thread overview]
Message-ID: <20201008035732.GA6535@magnolia> (raw)

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;
 
 	breq->hdr.icount = nr;
 	breq->hdr.ino = startino;

             reply	other threads:[~2020-10-08  3:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  3:57 Darrick J. Wong [this message]
2020-10-08 20:16 ` [PATCH] libfrog: fix a potential null pointer dereference Eric Sandeen
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=20201008035732.GA6535@magnolia \
    --to=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