forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-Wparentheses-equality in drivers/net/wireless/intel/ipw2x00/ipw2200.c #134
Labels
-Wparentheses-equality
[BUG] linux
A bug that should be fixed in the mainline kernel.
[FIXED][LINUX] 4.20
This bug was fixed in Linux 4.20
Comments
tpimh
added
[BUG] linux
A bug that should be fixed in the mainline kernel.
low priority
This bug is not critical and not a priority
-Wparentheses-equality
labels
Sep 20, 2018
nathanchance
added
[PATCH] Exists
There is a patch that fixes this issue
[PATCH] Submitted
A patch has been submitted for review
and removed
[PATCH] Exists
There is a patch that fixes this issue
labels
Sep 20, 2018
fengguang
pushed a commit
to 0day-ci/linux
that referenced
this issue
Sep 22, 2018
Clang warns when multiple pairs of parentheses are used for a single conditional statement. drivers/net/wireless/intel/ipw2x00/ipw2200.c:5655:28: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ drivers/net/wireless/intel/ipw2x00/ipw2200.c:5655:28: note: remove extraneous parentheses around the comparison to silence this warning if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { ~ ^ ~ drivers/net/wireless/intel/ipw2x00/ipw2200.c:5655:28: note: use '=' to turn this equality comparison into an assignment if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { ^~ = 1 warning generated. Link: ClangBuiltLinux#134 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
nathanchance
added
[PATCH] Accepted
A submitted patch has been accepted upstream
and removed
[PATCH] Submitted
A patch has been submitted for review
labels
Oct 1, 2018
nathanchance
added
[FIXED][LINUX] 4.20
This bug was fixed in Linux 4.20
and removed
[PATCH] Accepted
A submitted patch has been accepted upstream
labels
Oct 25, 2018
nathanchance
pushed a commit
that referenced
this issue
Mar 4, 2020
Dm-zoned initializes reference counters of new chunk works with zero value and refcount_inc() is called to increment the counter. However, the refcount_inc() function handles the addition to zero value as an error and triggers the warning as follows: refcount_t: addition on 0; use-after-free. WARNING: CPU: 7 PID: 1506 at lib/refcount.c:25 refcount_warn_saturate+0x68/0xf0 ... CPU: 7 PID: 1506 Comm: systemd-udevd Not tainted 5.4.0+ #134 ... Call Trace: dmz_map+0x2d2/0x350 [dm_zoned] __map_bio+0x42/0x1a0 __split_and_process_non_flush+0x14a/0x1b0 __split_and_process_bio+0x83/0x240 ? kmem_cache_alloc+0x165/0x220 dm_process_bio+0x90/0x230 ? generic_make_request_checks+0x2e7/0x680 dm_make_request+0x3e/0xb0 generic_make_request+0xcf/0x320 ? memcg_drain_all_list_lrus+0x1c0/0x1c0 submit_bio+0x3c/0x160 ? guard_bio_eod+0x2c/0x130 mpage_readpages+0x182/0x1d0 ? bdev_evict_inode+0xf0/0xf0 read_pages+0x6b/0x1b0 __do_page_cache_readahead+0x1ba/0x1d0 force_page_cache_readahead+0x93/0x100 generic_file_read_iter+0x83a/0xe40 ? __seccomp_filter+0x7b/0x670 new_sync_read+0x12a/0x1c0 vfs_read+0x9d/0x150 ksys_read+0x5f/0xe0 do_syscall_64+0x5b/0x180 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ... After this warning, following refcount API calls for the counter all fail to change the counter value. Fix this by setting the initial reference counter value not zero but one for the new chunk works. Instead, do not call refcount_inc() via dmz_get_chunk_work() for the new chunks works. The failure was observed with linux version 5.4 with CONFIG_REFCOUNT_FULL enabled. Refcount rework was merged to linux version 5.5 by the commit 168829a ("Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip"). After this commit, CONFIG_REFCOUNT_FULL was removed and the failure was observed regardless of kernel configuration. Linux version 4.20 merged the commit 092b564 ("dm zoned: target: use refcount_t for dm zoned reference counters"). Before this commit, dm zoned used atomic_t APIs which does not check addition to zero, then this fix is not necessary. Fixes: 092b564 ("dm zoned: target: use refcount_t for dm zoned reference counters") Cc: stable@vger.kernel.org # 5.4+ Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
-Wparentheses-equality
[BUG] linux
A bug that should be fixed in the mainline kernel.
[FIXED][LINUX] 4.20
This bug was fixed in Linux 4.20
The text was updated successfully, but these errors were encountered: