mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
Convert infiniband uverbs to struct_size
The flows were hidden from the C compiler; expose them as a zero-length array to allow struct_size to work. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
5b572e25c3
commit
7654cb1ba7
@ -3559,8 +3559,8 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
|
|||||||
goto err_uobj;
|
goto err_uobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
flow_attr = kzalloc(sizeof(*flow_attr) + cmd.flow_attr.num_of_specs *
|
flow_attr = kzalloc(struct_size(flow_attr, flows,
|
||||||
sizeof(union ib_flow_spec), GFP_KERNEL);
|
cmd.flow_attr.num_of_specs), GFP_KERNEL);
|
||||||
if (!flow_attr) {
|
if (!flow_attr) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_put;
|
goto err_put;
|
||||||
|
@ -2093,10 +2093,7 @@ struct ib_flow_attr {
|
|||||||
u32 flags;
|
u32 flags;
|
||||||
u8 num_of_specs;
|
u8 num_of_specs;
|
||||||
u8 port;
|
u8 port;
|
||||||
/* Following are the optional layers according to user request
|
union ib_flow_spec flows[];
|
||||||
* struct ib_flow_spec_xxx
|
|
||||||
* struct ib_flow_spec_yyy
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ib_flow {
|
struct ib_flow {
|
||||||
|
Loading…
Reference in New Issue
Block a user