* [PATCH] net/mlx4: suppress 'may be used uninitialized' warning @ 2017-04-18 6:21 Greg Thelen [not found] ` <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Greg Thelen @ 2017-04-18 6:21 UTC (permalink / raw) To: Or Gerlitz, Jack Morgenstein, Matan Barak Cc: Ido Shamay, Yishai Hadas, Amir Vadai, Roland Dreier, David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Greg Thelen gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized 'mpt' variable: drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper': drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized] mpt->mtt = mtt; I think this warning is a false complaint. mpt is only used when mr_res_start_move_to() return zero, and in all such cases it initializes mpt. But apparently gcc cannot see that. Initialize mpt to avoid the warning. Signed-off-by: Greg Thelen <gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> --- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index d8d5d161b8c7..4aa29ee93013 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c @@ -2749,7 +2749,7 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave, int err; int index = vhcr->in_modifier; struct res_mtt *mtt; - struct res_mpt *mpt; + struct res_mpt *mpt = NULL; int mtt_base = mr_get_mtt_addr(inbox->buf) / dev->caps.mtt_entry_sz; int phys; int id; -- 2.12.2.762.g0e3151a226-goog -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning [not found] ` <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> @ 2017-04-18 7:02 ` Leon Romanovsky 2017-04-18 7:24 ` Greg Thelen 2017-04-20 17:19 ` David Miller 1 sibling, 1 reply; 4+ messages in thread From: Leon Romanovsky @ 2017-04-18 7:02 UTC (permalink / raw) To: Greg Thelen Cc: Or Gerlitz, Jack Morgenstein, Matan Barak, Ido Shamay, Yishai Hadas, Amir Vadai, Roland Dreier, David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Tariq Toukan [-- Attachment #1: Type: text/plain, Size: 843 bytes --] On Mon, Apr 17, 2017 at 11:21:35PM -0700, Greg Thelen wrote: > gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized > 'mpt' variable: > drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper': > drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized] > mpt->mtt = mtt; > > I think this warning is a false complaint. mpt is only used when > mr_res_start_move_to() return zero, and in all such cases it initializes > mpt. > But apparently gcc cannot see that. > > Initialize mpt to avoid the warning. > > Signed-off-by: Greg Thelen <gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> > --- It looks like other callers of mr_res_start_move_to() have the same "uninitialized" variable. Thanks [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning 2017-04-18 7:02 ` Leon Romanovsky @ 2017-04-18 7:24 ` Greg Thelen 0 siblings, 0 replies; 4+ messages in thread From: Greg Thelen @ 2017-04-18 7:24 UTC (permalink / raw) To: Leon Romanovsky Cc: Or Gerlitz, Jack Morgenstein, Matan Barak, Ido Shamay, Yishai Hadas, Amir Vadai, Roland Dreier, David S. Miller, netdev, linux-rdma, linux-kernel, Tariq Toukan Leon Romanovsky <leon@kernel.org> wrote: > [ Unknown signature status ] > On Mon, Apr 17, 2017 at 11:21:35PM -0700, Greg Thelen wrote: >> gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized >> 'mpt' variable: >> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper': >> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized] >> mpt->mtt = mtt; >> >> I think this warning is a false complaint. mpt is only used when >> mr_res_start_move_to() return zero, and in all such cases it initializes >> mpt. >> But apparently gcc cannot see that. >> >> Initialize mpt to avoid the warning. >> >> Signed-off-by: Greg Thelen <gthelen@google.com> >> --- > > It looks like other callers of mr_res_start_move_to() have the same > "uninitialized" variable. > > Thanks The above is the only mellanox warning I see. So gcc is able to better analyze the other callsites. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning [not found] ` <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> 2017-04-18 7:02 ` Leon Romanovsky @ 2017-04-20 17:19 ` David Miller 1 sibling, 0 replies; 4+ messages in thread From: David Miller @ 2017-04-20 17:19 UTC (permalink / raw) To: gthelen-hpIqsD4AKlfQT0dZR+AlfA Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w, jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb, matanb-VPRAkNaXOzVWk0Htik3J/w, idos-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w, amirv-VPRAkNaXOzVWk0Htik3J/w, roland-BHEL68pLQRGGvPXPguhicg, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA From: Greg Thelen <gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Date: Mon, 17 Apr 2017 23:21:35 -0700 > gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized > 'mpt' variable: > drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper': > drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized] > mpt->mtt = mtt; > > I think this warning is a false complaint. mpt is only used when > mr_res_start_move_to() return zero, and in all such cases it initializes > mpt. But apparently gcc cannot see that. > > Initialize mpt to avoid the warning. > > Signed-off-by: Greg Thelen <gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Appied to net-next. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-20 17:19 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-04-18 6:21 [PATCH] net/mlx4: suppress 'may be used uninitialized' warning Greg Thelen [not found] ` <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> 2017-04-18 7:02 ` Leon Romanovsky 2017-04-18 7:24 ` Greg Thelen 2017-04-20 17:19 ` David Miller
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).