From: Darrick J. Wong Date: Mon, 12 Oct 2020 15:59:19 +0000 (-0400) Subject: libfrog: fix a potential null pointer dereference X-Git-Tag: v5.9.0-rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0779e54dc66f5c09a80be3a0a7d782edf464bbb8;p=thirdparty%2Fxfsprogs-dev.git libfrog: fix a potential null pointer dereference 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 Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/libfrog/bulkstat.c b/libfrog/bulkstat.c index c3e5c5f80..195f6ea05 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;