* [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask
@ 2022-12-09 12:07 Horatiu Vultur
2022-12-09 23:19 ` Saeed Mahameed
2022-12-12 21:02 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-12-09 12:07 UTC (permalink / raw)
To: linux-arm-kernel, netdev, linux-kernel
Cc: davem, edumazet, kuba, pabeni, Steen.Hegelund, daniel.machon,
lars.povlsen, UNGLinuxDriver, Horatiu Vultur, kernel test robot,
Dan Carpenter
Fix the following smatch warning:
smatch warnings:
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:103 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'value'.
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:106 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'mask'.
In case the vcap field was VCAP_FIELD_U128 and the key was different
than IP6_S/DIP then the value and mask were not initialized, therefore
initialize them.
Fixes: 610c32b2ce66 ("net: microchip: vcap: Add vcap_get_rule")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
index 895bfff550d23..1237601ac9dc1 100644
--- a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
+++ b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
@@ -83,6 +83,8 @@ static void vcap_debugfs_show_rule_keyfield(struct vcap_control *vctrl,
hex = true;
break;
case VCAP_FIELD_U128:
+ value = data->u128.value;
+ mask = data->u128.value;
if (key == VCAP_KF_L3_IP6_SIP || key == VCAP_KF_L3_IP6_DIP) {
u8 nvalue[16], nmask[16];
--
2.38.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask
2022-12-09 12:07 [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask Horatiu Vultur
@ 2022-12-09 23:19 ` Saeed Mahameed
2022-12-12 21:02 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2022-12-09 23:19 UTC (permalink / raw)
To: Horatiu Vultur
Cc: linux-arm-kernel, netdev, linux-kernel, davem, edumazet, kuba,
pabeni, Steen.Hegelund, daniel.machon, lars.povlsen,
UNGLinuxDriver, kernel test robot, Dan Carpenter
On 09 Dec 13:07, Horatiu Vultur wrote:
>Fix the following smatch warning:
>
>smatch warnings:
>drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:103 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'value'.
>drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:106 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'mask'.
>
>In case the vcap field was VCAP_FIELD_U128 and the key was different
>than IP6_S/DIP then the value and mask were not initialized, therefore
>initialize them.
>
>Fixes: 610c32b2ce66 ("net: microchip: vcap: Add vcap_get_rule")
>Reported-by: kernel test robot <lkp@intel.com>
>Reported-by: Dan Carpenter <error27@gmail.com>
>Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Saeed Mahameed <saeed@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask
2022-12-09 12:07 [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask Horatiu Vultur
2022-12-09 23:19 ` Saeed Mahameed
@ 2022-12-12 21:02 ` Jakub Kicinski
2022-12-13 7:35 ` Horatiu Vultur
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2022-12-12 21:02 UTC (permalink / raw)
To: Horatiu Vultur
Cc: linux-arm-kernel, netdev, linux-kernel, davem, edumazet, pabeni,
Steen.Hegelund, daniel.machon, lars.povlsen, UNGLinuxDriver,
kernel test robot, Dan Carpenter
On Fri, 9 Dec 2022 13:07:01 +0100 Horatiu Vultur wrote:
> case VCAP_FIELD_U128:
> + value = data->u128.value;
> + mask = data->u128.value;
If setting both to value is intentional - please mention in the commit
message. Otherwise this looks odd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask
2022-12-12 21:02 ` Jakub Kicinski
@ 2022-12-13 7:35 ` Horatiu Vultur
0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-12-13 7:35 UTC (permalink / raw)
To: Jakub Kicinski
Cc: linux-arm-kernel, netdev, linux-kernel, davem, edumazet, pabeni,
Steen.Hegelund, daniel.machon, lars.povlsen, UNGLinuxDriver,
kernel test robot, Dan Carpenter
The 12/12/2022 13:02, Jakub Kicinski wrote:
>
> On Fri, 9 Dec 2022 13:07:01 +0100 Horatiu Vultur wrote:
> > case VCAP_FIELD_U128:
> > + value = data->u128.value;
> > + mask = data->u128.value;
>
> If setting both to value is intentional - please mention in the commit
> message. Otherwise this looks odd.
It should not be both set to value. Will fix this in th next version.
--
/Horatiu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-13 7:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 12:07 [PATCH net-next] net: microchip: vcap: Fix initialization of value and mask Horatiu Vultur
2022-12-09 23:19 ` Saeed Mahameed
2022-12-12 21:02 ` Jakub Kicinski
2022-12-13 7:35 ` Horatiu Vultur
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).