* [PATCH] libfrog: fix a potential null pointer dereference
@ 2020-10-08 3:57 Darrick J. Wong
2020-10-08 20:16 ` Eric Sandeen
2020-10-15 8:26 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-10-08 3:57 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libfrog: fix a potential null pointer dereference
2020-10-08 3:57 [PATCH] libfrog: fix a potential null pointer dereference Darrick J. Wong
@ 2020-10-08 20:16 ` Eric Sandeen
2020-10-15 8:26 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2020-10-08 20:16 UTC (permalink / raw)
To: Darrick J. Wong, Eric Sandeen; +Cc: xfs
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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libfrog: fix a potential null pointer dereference
2020-10-08 3:57 [PATCH] libfrog: fix a potential null pointer dereference Darrick J. Wong
2020-10-08 20:16 ` Eric Sandeen
@ 2020-10-15 8:26 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-10-15 8:26 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, xfs
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-15 8:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 3:57 [PATCH] libfrog: fix a potential null pointer dereference Darrick J. Wong
2020-10-08 20:16 ` Eric Sandeen
2020-10-15 8:26 ` Christoph Hellwig
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).