]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: cls_u32: use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 1 May 2019 16:23:15 +0000 (11:23 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 May 2019 04:46:27 +0000 (00:46 -0400)
commit26ef6c6fa2eb07846da7be12ea208088c383368d
tree07cef2c1b90085c8bb01f7923e034c6e0c90f787
parent842b8e16d21787485b1e38172870f277588685e7
net: sched: cls_u32: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace code of the following form:

sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)

with:

struct_size(s, keys, s->nkeys)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_u32.c