Commit b93884ee authored by Kees Cook's avatar Kees Cook Committed by Jakub Kicinski

net/ncsi: Silence runtime memcpy() false positive warning

The memcpy() in ncsi_cmd_handler_oem deserializes nca->data into a
flexible array structure that overlapping with non-flex-array members
(mfr_id) intentionally. Since the mem_to_flex() API is not finished,
temporarily silence this warning, since it is a false positive, using
unsafe_memcpy().
Reported-by: default avatarJoel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/netdev/CACPK8Xdfi=OJKP0x0D1w87fQeFZ4A2DP2qzGCRcuVbpU-9=4sQ@mail.gmail.com/
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221202212418.never.837-kees@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 01d0e110
...@@ -228,7 +228,8 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb, ...@@ -228,7 +228,8 @@ static int ncsi_cmd_handler_oem(struct sk_buff *skb,
len += max(payload, padding_bytes); len += max(payload, padding_bytes);
cmd = skb_put_zero(skb, len); cmd = skb_put_zero(skb, len);
memcpy(&cmd->mfr_id, nca->data, nca->payload); unsafe_memcpy(&cmd->mfr_id, nca->data, nca->payload,
/* skb allocated with enough to load the payload */);
ncsi_cmd_build_header(&cmd->cmd.common, nca); ncsi_cmd_build_header(&cmd->cmd.common, nca);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment