]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: fix a potential null pointer dereference
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 12 Oct 2020 15:59:19 +0000 (11:59 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 12 Oct 2020 15:59:19 +0000 (11:59 -0400)
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>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libfrog/bulkstat.c

index c3e5c5f804e46d08fb3223e075efcb5c34ae0dea..195f6ea053bd165c8c015cf002c3703cac99f693 100644 (file)
@@ -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;