* [Cluster-devel] fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
[not found] <20210329004759.GH4176174@shao2-debian>
@ 2021-04-02 18:03 ` Andreas Gruenbacher
0 siblings, 0 replies; only message in thread
From: Andreas Gruenbacher @ 2021-04-02 18:03 UTC (permalink / raw)
To: cluster-devel.redhat.com
gfs2: Silence possible null pointer dereference warning
In gfs2_rbm_find, rs is always NULL when minext is NULL, so
gfs2_reservation_check_and_update will never be called on a NULL minext.
This isn't immediately obvious though, so also check for a NULL minext
for better code readability.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/rgrp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 89c37a845e64..2dab313442a7 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1783,7 +1783,7 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
goto next_bitmap;
}
rbm->offset = offset;
- if (!rs)
+ if (!rs || !minext)
return 0;
ret = gfs2_reservation_check_and_update(rbm, rs, *minext,
--
2.27.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-02 18:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210329004759.GH4176174@shao2-debian>
2021-04-02 18:03 ` [Cluster-devel] fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer] Andreas Gruenbacher
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).