Skip to content

Commit

Permalink
cxgb4: Use struct_size() helper
Browse files Browse the repository at this point in the history
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gustavo A. R. Silva authored and David S. Miller committed Jun 19, 2020
1 parent f362b70 commit a422d5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/cxgb4/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
struct sk_buff *skb;
int ret = 0;

len = sizeof(*flowc) + sizeof(struct fw_flowc_mnemval) * nparams;
len = struct_size(flowc, mnemval, nparams);
len16 = DIV_ROUND_UP(len, 16);

entry = cxgb4_lookup_eotid(&adap->tids, eotid);
Expand Down

0 comments on commit a422d5f

Please sign in to comment.