Skip to contentSkip to conversation

writeback: fix call of incorrect macro

PATCH Applied Maxim Korotkov 3 participants 5 messages Jan 19, 2023 – Apr 28, 2023 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 writeback: fix call of incorrect macro

the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 2a81490811d0 ("writeback: implement foreign cgroup inode detection")
---
 fs/fs-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs-writeback.c +1 -1
index 6fba5a52127b..fc16123b2405 100644
@@ -829,7 +829,7 @@ void wbc_detach_inode(struct writeback_control *wbc)
 		 * is okay.  The main goal is avoiding keeping an inode on
 		 * the wrong wb for an extended period of time.
 		 */
-		if (hweight32(history) > WB_FRN_HIST_THR_SLOTS)
+		if (hweight16(history) > WB_FRN_HIST_THR_SLOTS)
 			inode_switch_wbs(inode, max_id);
 	}
 
Signature · 1 line
2.37.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Maxim Korotkov

the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 2a81490811d0 ("writeback: implement foreign cgroup inode detection")

Looks good to me, although it is mostly a theoretical issue - I don't see how hweight32 could do any harm here. Anyway, feel free to add:

Honza

Quoted 20 lines
---
 fs/fs-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs-writeback.c +1 -1
index 6fba5a52127b..fc16123b2405 100644
@@ -829,7 +829,7 @@ void wbc_detach_inode(struct writeback_control *wbc)
 		 * is okay.  The main goal is avoiding keeping an inode on
 		 * the wrong wb for an extended period of time.
 		 */
-		if (hweight32(history) > WB_FRN_HIST_THR_SLOTS)
+		if (hweight16(history) > WB_FRN_HIST_THR_SLOTS)
 			inode_switch_wbs(inode, max_id);
 	}
 
Signature · 1 line
2.37.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw

Hi,
Will this patch be applied or rejected?
best regards, Max

Quoted 37 lines · Jan Kara
Quoted 8 lines · Maxim Korotkov

the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 2a81490811d0 ("writeback: implement foreign cgroup inode detection")

Looks good to me, although it is mostly a theoretical issue - I don't see how hweight32 could do any harm here. Anyway, feel free to add:

Honza

Quoted 20 lines
---
  fs/fs-writeback.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs-writeback.c +1 -1
index 6fba5a52127b..fc16123b2405 100644
@@ -829,7 +829,7 @@ void wbc_detach_inode(struct writeback_control *wbc)
  		 * is okay.  The main goal is avoiding keeping an inode on
  		 * the wrong wb for an extended period of time.
  		 */
-		if (hweight32(history) > WB_FRN_HIST_THR_SLOTS)
+		if (hweight16(history) > WB_FRN_HIST_THR_SLOTS)
  			inode_switch_wbs(inode, max_id);
  	}
 
Signature · 1 line
2.37.2
reviewer
#3 lore raw

Hi!

Jens, can you please pickup this patch? It has fallen through the cracks. Usually you tend to be picking up cgroup writeback stuff. Thanks!

Honza

Quoted 42 lines · Maxim Korotkov

Hi,
Will this patch be applied or rejected?
best regards, Max

Quoted 36 lines · Jan Kara
Quoted 8 lines · Maxim Korotkov

the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 2a81490811d0 ("writeback: implement foreign cgroup inode detection")

Looks good to me, although it is mostly a theoretical issue - I don't see how hweight32 could do any harm here. Anyway, feel free to add:

Honza

Quoted 19 lines
---
  fs/fs-writeback.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs-writeback.c +1 -1
index 6fba5a52127b..fc16123b2405 100644
@@ -829,7 +829,7 @@ void wbc_detach_inode(struct writeback_control *wbc)
  		 * is okay.  The main goal is avoiding keeping an inode on
  		 * the wrong wb for an extended period of time.
  		 */
-		if (hweight32(history) > WB_FRN_HIST_THR_SLOTS)
+		if (hweight16(history) > WB_FRN_HIST_THR_SLOTS)
  			inode_switch_wbs(inode, max_id);
  	}
Signature · 1 line
2.37.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
Applied
#4 lore raw
In reply to Maxim Korotkov
Quoted 8 lines · Maxim Korotkov

the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used

Found by Linux Verification Center (linuxtesting.org) with SVACE.

[...]

Applied, thanks!

[1/1] writeback: fix call of incorrect macro

      commit: 3e46c89c74f2c38e5337d2cf44b0b551adff1cb4

Best regards,

Signature · 1 line
Jens Axboe