* [PATCH net] Revert "flow_offload: action should not be NULL when it is referenced"
@ 2021-08-19 10:58 Ido Schimmel
2021-08-19 11:51 ` Jamal Hadi Salim
0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2021-08-19 10:58 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, jhs, mlxsw, Ido Schimmel, gushengxian
From: Ido Schimmel <idosch@nvidia.com>
This reverts commit 9ea3e52c5bc8bb4a084938dc1e3160643438927a.
Cited commit added a check to make sure 'action' is not NULL, but
'action' is already dereferenced before the check, when calling
flow_offload_has_one_action().
Therefore, the check does not make any sense and results in a smatch
warning:
include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn:
variable dereferenced before check 'action' (see line 319)
Fix by reverting this commit.
Cc: gushengxian <gushengxian@yulong.com>
Fixes: 9ea3e52c5bc8 ("flow_offload: action should not be NULL when it is referenced")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
include/net/flow_offload.h | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index f3c2841566a0..1b9d75aedb22 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -319,14 +319,12 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action,
if (flow_offload_has_one_action(action))
return true;
- if (action) {
- flow_action_for_each(i, action_entry, action) {
- if (i && action_entry->hw_stats != last_hw_stats) {
- NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported");
- return false;
- }
- last_hw_stats = action_entry->hw_stats;
+ flow_action_for_each(i, action_entry, action) {
+ if (i && action_entry->hw_stats != last_hw_stats) {
+ NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported");
+ return false;
}
+ last_hw_stats = action_entry->hw_stats;
}
return true;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] Revert "flow_offload: action should not be NULL when it is referenced"
2021-08-19 10:58 [PATCH net] Revert "flow_offload: action should not be NULL when it is referenced" Ido Schimmel
@ 2021-08-19 11:51 ` Jamal Hadi Salim
2021-08-19 18:15 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Jamal Hadi Salim @ 2021-08-19 11:51 UTC (permalink / raw)
To: Ido Schimmel, netdev; +Cc: davem, kuba, mlxsw, Ido Schimmel, gushengxian
On 2021-08-19 6:58 a.m., Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
>
> This reverts commit 9ea3e52c5bc8bb4a084938dc1e3160643438927a.
>
> Cited commit added a check to make sure 'action' is not NULL, but
> 'action' is already dereferenced before the check, when calling
> flow_offload_has_one_action().
>
> Therefore, the check does not make any sense and results in a smatch
> warning:
>
> include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn:
> variable dereferenced before check 'action' (see line 319)
>
> Fix by reverting this commit.
>
> Cc: gushengxian <gushengxian@yulong.com>
> Fixes: 9ea3e52c5bc8 ("flow_offload: action should not be NULL when it is referenced")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
cheers,
jamal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] Revert "flow_offload: action should not be NULL when it is referenced"
2021-08-19 11:51 ` Jamal Hadi Salim
@ 2021-08-19 18:15 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-08-19 18:15 UTC (permalink / raw)
To: Jamal Hadi Salim, Ido Schimmel
Cc: netdev, davem, mlxsw, Ido Schimmel, gushengxian
On Thu, 19 Aug 2021 07:51:15 -0400 Jamal Hadi Salim wrote:
> On 2021-08-19 6:58 a.m., Ido Schimmel wrote:
> > From: Ido Schimmel <idosch@nvidia.com>
> >
> > This reverts commit 9ea3e52c5bc8bb4a084938dc1e3160643438927a.
> >
> > Cited commit added a check to make sure 'action' is not NULL, but
> > 'action' is already dereferenced before the check, when calling
> > flow_offload_has_one_action().
> >
> > Therefore, the check does not make any sense and results in a smatch
> > warning:
> >
> > include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn:
> > variable dereferenced before check 'action' (see line 319)
> >
> > Fix by reverting this commit.
> >
> > Cc: gushengxian <gushengxian@yulong.com>
> > Fixes: 9ea3e52c5bc8 ("flow_offload: action should not be NULL when it is referenced")
> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-19 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 10:58 [PATCH net] Revert "flow_offload: action should not be NULL when it is referenced" Ido Schimmel
2021-08-19 11:51 ` Jamal Hadi Salim
2021-08-19 18:15 ` Jakub Kicinski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.