* [PATCH] xfs: fix integer overflow in xrep_bmap
@ 2024-10-08 4:07 Darrick J. Wong
2024-10-08 4:33 ` Christoph Hellwig
2024-10-15 11:09 ` Carlos Maiolino
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2024-10-08 4:07 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: xfs, Christoph Hellwig
From: Darrick J. Wong <djwong@kernel.org>
The variable declaration in this function predates the merge of the
nrext64 (aka 64-bit extent counters) feature, which means that the
variable declaration type is insufficient to avoid an integer overflow.
Fix that by redeclaring the variable to be xfs_extnum_t.
Coverity-id: 1630958
Fixes: 8f71bede8efd ("xfs: repair inode fork block mapping data structures")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/scrub/bmap_repair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/scrub/bmap_repair.c b/fs/xfs/scrub/bmap_repair.c
index 49dc38acc66bf..4505f4829d53f 100644
--- a/fs/xfs/scrub/bmap_repair.c
+++ b/fs/xfs/scrub/bmap_repair.c
@@ -801,7 +801,7 @@ xrep_bmap(
{
struct xrep_bmap *rb;
char *descr;
- unsigned int max_bmbt_recs;
+ xfs_extnum_t max_bmbt_recs;
bool large_extcount;
int error = 0;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix integer overflow in xrep_bmap
2024-10-08 4:07 [PATCH] xfs: fix integer overflow in xrep_bmap Darrick J. Wong
@ 2024-10-08 4:33 ` Christoph Hellwig
2024-10-15 11:09 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-10-08 4:33 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Carlos Maiolino, xfs, Christoph Hellwig
On Mon, Oct 07, 2024 at 09:07:08PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> The variable declaration in this function predates the merge of the
> nrext64 (aka 64-bit extent counters) feature, which means that the
> variable declaration type is insufficient to avoid an integer overflow.
> Fix that by redeclaring the variable to be xfs_extnum_t.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix integer overflow in xrep_bmap
2024-10-08 4:07 [PATCH] xfs: fix integer overflow in xrep_bmap Darrick J. Wong
2024-10-08 4:33 ` Christoph Hellwig
@ 2024-10-15 11:09 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2024-10-15 11:09 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs, Christoph Hellwig
On Mon, 07 Oct 2024 21:07:08 -0700, Darrick J. Wong wrote:
> The variable declaration in this function predates the merge of the
> nrext64 (aka 64-bit extent counters) feature, which means that the
> variable declaration type is insufficient to avoid an integer overflow.
> Fix that by redeclaring the variable to be xfs_extnum_t.
>
>
Applied to for-next, thanks!
[1/1] xfs: fix integer overflow in xrep_bmap
commit: 0fb823f1cf3417e06846d1ffe2c97e10a65a847e
Best regards,
--
Carlos Maiolino <cem@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-15 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 4:07 [PATCH] xfs: fix integer overflow in xrep_bmap Darrick J. Wong
2024-10-08 4:33 ` Christoph Hellwig
2024-10-15 11:09 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox