* fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
@ 2021-03-29 0:47 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-03-29 0:47 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: kbuild-all, linux-kernel
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0f4498cef9f5cd18d7c6639a2a902ec1edc5be4e
commit: f38e998fbbb5da6a097ecd4b2700ba95eabab0c9 gfs2: Also reflect single-block allocations in rgd->rd_extfail_pt
compiler: sparc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
fs/gfs2/rgrp.c:1846:52: note: Calling function 'gfs2_rbm_find', 3rd argument 'NULL' value is 0
error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, NULL, NULL,
^
fs/gfs2/rgrp.c:1772:53: note: Null pointer dereference
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
vim +1772 fs/gfs2/rgrp.c
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1711
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1712 /**
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1713 * gfs2_rbm_find - Look for blocks of a particular state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1714 * @rbm: Value/result starting position and final position
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1715 * @state: The state which we want to find
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 1716 * @minext: Pointer to the requested extent length
5ce13431dd3365 Bob Peterson 2013-11-06 1717 * This is updated to be the actual reservation size.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1718 * @ip: If set, check for reservations
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1719 * @nowrap: Stop looking at the end of the rgrp, rather than wrapping
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1720 * around until we've reached the starting point.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1721 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1722 * Side effects:
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1723 * - If looking for free blocks, we set GBF_FULL on each bitmap which
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1724 * has no free blocks in it.
5ea5050cec9c02 Bob Peterson 2013-11-25 1725 * - If looking for free blocks, we set rd_extfail_pt on each rgrp which
5ea5050cec9c02 Bob Peterson 2013-11-25 1726 * has come up short on a free block search.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1727 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1728 * Returns: 0 on success, -ENOSPC if there is no block of the requested state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1729 */
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1730
5ce13431dd3365 Bob Peterson 2013-11-06 1731 static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
8381e602275586 Bob Peterson 2016-05-02 1732 const struct gfs2_inode *ip, bool nowrap)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1733 {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1734 bool scan_from_start = rbm->bii == 0 && rbm->offset == 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1735 struct buffer_head *bh;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1736 int last_bii;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1737 u32 offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1738 u8 *buffer;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1739 bool wrapped = false;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1740 int ret;
e579ed4f446e64 Bob Peterson 2013-09-17 1741 struct gfs2_bitmap *bi;
5ce13431dd3365 Bob Peterson 2013-11-06 1742 struct gfs2_extent maxext = { .rbm.rgd = rbm->rgd, };
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1743
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1744 /*
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1745 * Determine the last bitmap to search. If we're not starting at the
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1746 * beginning of a bitmap, we need to search that bitmap twice to scan
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1747 * the entire resource group.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1748 */
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1749 last_bii = rbm->bii - (rbm->offset == 0);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1750
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1751 while(1) {
e579ed4f446e64 Bob Peterson 2013-09-17 1752 bi = rbm_bi(rbm);
2fdc2fa21bc72e Andreas Gruenbacher 2020-10-06 1753 if (test_bit(GBF_FULL, &bi->bi_flags) &&
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1754 (state == GFS2_BLKST_FREE))
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1755 goto next_bitmap;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1756
e579ed4f446e64 Bob Peterson 2013-09-17 1757 bh = bi->bi_bh;
e579ed4f446e64 Bob Peterson 2013-09-17 1758 buffer = bh->b_data + bi->bi_offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1759 WARN_ON(!buffer_uptodate(bh));
e579ed4f446e64 Bob Peterson 2013-09-17 1760 if (state != GFS2_BLKST_UNLINKED && bi->bi_clone)
e579ed4f446e64 Bob Peterson 2013-09-17 1761 buffer = bi->bi_clone + bi->bi_offset;
281b4952d185a3 Andreas Gruenbacher 2018-09-26 1762 offset = gfs2_bitfit(buffer, bi->bi_bytes, rbm->offset, state);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1763 if (offset == BFITNOENT) {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1764 if (state == GFS2_BLKST_FREE && rbm->offset == 0)
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1765 set_bit(GBF_FULL, &bi->bi_flags);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1766 goto next_bitmap;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1767 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1768 rbm->offset = offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1769 if (ip == NULL)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1770 return 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1771
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 @1772 ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
5ce13431dd3365 Bob Peterson 2013-11-06 1773 &maxext);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1774 if (ret == 0)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1775 return 0;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1776 if (ret > 0)
8d8b752a0f5528 Bob Peterson 2012-08-07 1777 goto next_iter;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1778 if (ret == -E2BIG) {
e579ed4f446e64 Bob Peterson 2013-09-17 1779 rbm->bii = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1780 rbm->offset = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1781 goto res_covered_end_of_rgrp;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1782 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1783 return ret;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1784
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
@ 2021-03-29 0:47 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-03-29 0:47 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7440 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0f4498cef9f5cd18d7c6639a2a902ec1edc5be4e
commit: f38e998fbbb5da6a097ecd4b2700ba95eabab0c9 gfs2: Also reflect single-block allocations in rgd->rd_extfail_pt
compiler: sparc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
fs/gfs2/rgrp.c:1846:52: note: Calling function 'gfs2_rbm_find', 3rd argument 'NULL' value is 0
error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, NULL, NULL,
^
fs/gfs2/rgrp.c:1772:53: note: Null pointer dereference
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
vim +1772 fs/gfs2/rgrp.c
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1711
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1712 /**
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1713 * gfs2_rbm_find - Look for blocks of a particular state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1714 * @rbm: Value/result starting position and final position
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1715 * @state: The state which we want to find
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 1716 * @minext: Pointer to the requested extent length
5ce13431dd3365 Bob Peterson 2013-11-06 1717 * This is updated to be the actual reservation size.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1718 * @ip: If set, check for reservations
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1719 * @nowrap: Stop looking at the end of the rgrp, rather than wrapping
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1720 * around until we've reached the starting point.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1721 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1722 * Side effects:
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1723 * - If looking for free blocks, we set GBF_FULL on each bitmap which
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1724 * has no free blocks in it.
5ea5050cec9c02 Bob Peterson 2013-11-25 1725 * - If looking for free blocks, we set rd_extfail_pt on each rgrp which
5ea5050cec9c02 Bob Peterson 2013-11-25 1726 * has come up short on a free block search.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1727 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1728 * Returns: 0 on success, -ENOSPC if there is no block of the requested state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1729 */
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1730
5ce13431dd3365 Bob Peterson 2013-11-06 1731 static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
8381e602275586 Bob Peterson 2016-05-02 1732 const struct gfs2_inode *ip, bool nowrap)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1733 {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1734 bool scan_from_start = rbm->bii == 0 && rbm->offset == 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1735 struct buffer_head *bh;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1736 int last_bii;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1737 u32 offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1738 u8 *buffer;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1739 bool wrapped = false;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1740 int ret;
e579ed4f446e64 Bob Peterson 2013-09-17 1741 struct gfs2_bitmap *bi;
5ce13431dd3365 Bob Peterson 2013-11-06 1742 struct gfs2_extent maxext = { .rbm.rgd = rbm->rgd, };
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1743
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1744 /*
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1745 * Determine the last bitmap to search. If we're not starting at the
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1746 * beginning of a bitmap, we need to search that bitmap twice to scan
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1747 * the entire resource group.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1748 */
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1749 last_bii = rbm->bii - (rbm->offset == 0);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1750
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1751 while(1) {
e579ed4f446e64 Bob Peterson 2013-09-17 1752 bi = rbm_bi(rbm);
2fdc2fa21bc72e Andreas Gruenbacher 2020-10-06 1753 if (test_bit(GBF_FULL, &bi->bi_flags) &&
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1754 (state == GFS2_BLKST_FREE))
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1755 goto next_bitmap;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1756
e579ed4f446e64 Bob Peterson 2013-09-17 1757 bh = bi->bi_bh;
e579ed4f446e64 Bob Peterson 2013-09-17 1758 buffer = bh->b_data + bi->bi_offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1759 WARN_ON(!buffer_uptodate(bh));
e579ed4f446e64 Bob Peterson 2013-09-17 1760 if (state != GFS2_BLKST_UNLINKED && bi->bi_clone)
e579ed4f446e64 Bob Peterson 2013-09-17 1761 buffer = bi->bi_clone + bi->bi_offset;
281b4952d185a3 Andreas Gruenbacher 2018-09-26 1762 offset = gfs2_bitfit(buffer, bi->bi_bytes, rbm->offset, state);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1763 if (offset == BFITNOENT) {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1764 if (state == GFS2_BLKST_FREE && rbm->offset == 0)
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1765 set_bit(GBF_FULL, &bi->bi_flags);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1766 goto next_bitmap;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1767 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1768 rbm->offset = offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1769 if (ip == NULL)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1770 return 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1771
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 @1772 ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
5ce13431dd3365 Bob Peterson 2013-11-06 1773 &maxext);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1774 if (ret == 0)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1775 return 0;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1776 if (ret > 0)
8d8b752a0f5528 Bob Peterson 2012-08-07 1777 goto next_iter;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1778 if (ret == -E2BIG) {
e579ed4f446e64 Bob Peterson 2013-09-17 1779 rbm->bii = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1780 rbm->offset = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1781 goto res_covered_end_of_rgrp;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1782 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1783 return ret;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1784
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
2021-03-29 0:47 ` kernel test robot
(?)
@ 2021-04-02 18:03 ` Andreas Gruenbacher
-1 siblings, 0 replies; 6+ messages in thread
From: Andreas Gruenbacher @ 2021-04-02 18:03 UTC (permalink / raw)
To: cluster-devel
Cc: Andreas Gruenbacher, kbuild-all, linux-kernel, kernel test robot
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] 6+ messages in thread
* Re: fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
@ 2021-04-02 18:03 ` Andreas Gruenbacher
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Gruenbacher @ 2021-04-02 18:03 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 892 bytes --]
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] 6+ messages in thread
* [Cluster-devel] fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
@ 2021-04-02 18:03 ` Andreas Gruenbacher
0 siblings, 0 replies; 6+ messages 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] 6+ messages in thread
* fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
@ 2021-03-27 9:11 kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-03-27 9:11 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 7644 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Andreas Gruenbacher <agruenba@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0f4498cef9f5cd18d7c6639a2a902ec1edc5be4e
commit: f38e998fbbb5da6a097ecd4b2700ba95eabab0c9 gfs2: Also reflect single-block allocations in rgd->rd_extfail_pt
date: 5 weeks ago
:::::: branch date: 14 hours ago
:::::: commit date: 5 weeks ago
compiler: sparc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer]
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
fs/gfs2/rgrp.c:1846:52: note: Calling function 'gfs2_rbm_find', 3rd argument 'NULL' value is 0
error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, NULL, NULL,
^
fs/gfs2/rgrp.c:1772:53: note: Null pointer dereference
ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
^
vim +1772 fs/gfs2/rgrp.c
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1711
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1712 /**
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1713 * gfs2_rbm_find - Look for blocks of a particular state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1714 * @rbm: Value/result starting position and final position
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1715 * @state: The state which we want to find
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 1716 * @minext: Pointer to the requested extent length
5ce13431dd3365 Bob Peterson 2013-11-06 1717 * This is updated to be the actual reservation size.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1718 * @ip: If set, check for reservations
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1719 * @nowrap: Stop looking at the end of the rgrp, rather than wrapping
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1720 * around until we've reached the starting point.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1721 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1722 * Side effects:
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1723 * - If looking for free blocks, we set GBF_FULL on each bitmap which
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1724 * has no free blocks in it.
5ea5050cec9c02 Bob Peterson 2013-11-25 1725 * - If looking for free blocks, we set rd_extfail_pt on each rgrp which
5ea5050cec9c02 Bob Peterson 2013-11-25 1726 * has come up short on a free block search.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1727 *
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1728 * Returns: 0 on success, -ENOSPC if there is no block of the requested state
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1729 */
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1730
5ce13431dd3365 Bob Peterson 2013-11-06 1731 static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
8381e602275586 Bob Peterson 2016-05-02 1732 const struct gfs2_inode *ip, bool nowrap)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1733 {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1734 bool scan_from_start = rbm->bii == 0 && rbm->offset == 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1735 struct buffer_head *bh;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1736 int last_bii;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1737 u32 offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1738 u8 *buffer;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1739 bool wrapped = false;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1740 int ret;
e579ed4f446e64 Bob Peterson 2013-09-17 1741 struct gfs2_bitmap *bi;
5ce13431dd3365 Bob Peterson 2013-11-06 1742 struct gfs2_extent maxext = { .rbm.rgd = rbm->rgd, };
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1743
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1744 /*
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1745 * Determine the last bitmap to search. If we're not starting at the
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1746 * beginning of a bitmap, we need to search that bitmap twice to scan
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1747 * the entire resource group.
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1748 */
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1749 last_bii = rbm->bii - (rbm->offset == 0);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1750
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1751 while(1) {
e579ed4f446e64 Bob Peterson 2013-09-17 1752 bi = rbm_bi(rbm);
2fdc2fa21bc72e Andreas Gruenbacher 2020-10-06 1753 if (test_bit(GBF_FULL, &bi->bi_flags) &&
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1754 (state == GFS2_BLKST_FREE))
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1755 goto next_bitmap;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1756
e579ed4f446e64 Bob Peterson 2013-09-17 1757 bh = bi->bi_bh;
e579ed4f446e64 Bob Peterson 2013-09-17 1758 buffer = bh->b_data + bi->bi_offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1759 WARN_ON(!buffer_uptodate(bh));
e579ed4f446e64 Bob Peterson 2013-09-17 1760 if (state != GFS2_BLKST_UNLINKED && bi->bi_clone)
e579ed4f446e64 Bob Peterson 2013-09-17 1761 buffer = bi->bi_clone + bi->bi_offset;
281b4952d185a3 Andreas Gruenbacher 2018-09-26 1762 offset = gfs2_bitfit(buffer, bi->bi_bytes, rbm->offset, state);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1763 if (offset == BFITNOENT) {
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1764 if (state == GFS2_BLKST_FREE && rbm->offset == 0)
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1765 set_bit(GBF_FULL, &bi->bi_flags);
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1766 goto next_bitmap;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1767 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1768 rbm->offset = offset;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1769 if (ip == NULL)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1770 return 0;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1771
f38e998fbbb5da Andreas Gruenbacher 2020-10-05 @1772 ret = gfs2_reservation_check_and_update(rbm, ip, *minext,
5ce13431dd3365 Bob Peterson 2013-11-06 1773 &maxext);
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1774 if (ret == 0)
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1775 return 0;
71921ef85928e9 Andreas Gruenbacher 2019-03-14 1776 if (ret > 0)
8d8b752a0f5528 Bob Peterson 2012-08-07 1777 goto next_iter;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1778 if (ret == -E2BIG) {
e579ed4f446e64 Bob Peterson 2013-09-17 1779 rbm->bii = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1780 rbm->offset = 0;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1781 goto res_covered_end_of_rgrp;
5d50d5324612d2 Steven Whitehouse 2012-08-07 1782 }
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1783 return ret;
5b924ae2dcb1cc Steven Whitehouse 2012-08-01 1784
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-02 18:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 0:47 fs/gfs2/rgrp.c:1772:53: warning: Possible null pointer dereference: minext [nullPointer] kernel test robot
2021-03-29 0:47 ` kernel test robot
2021-04-02 18:03 ` Andreas Gruenbacher
2021-04-02 18:03 ` [Cluster-devel] " Andreas Gruenbacher
2021-04-02 18:03 ` Andreas Gruenbacher
-- strict thread matches above, loose matches on Subject: below --
2021-03-27 9:11 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.