Message ID | 20220216030720.1839503-1-chi.minghao@zte.com.cn (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | rpmsg: use struct_size over open coded arithmetic | expand |
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 1030cfa80e04..f4f4e392d0d1 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -792,7 +792,7 @@ static int qcom_glink_rx_defer(struct qcom_glink *glink, size_t extra) return -ENXIO; } - dcmd = kzalloc(sizeof(*dcmd) + extra, GFP_ATOMIC); + dcmd = kzalloc(struct_size(dcmd, data, extra), GFP_ATOMIC); if (!dcmd) return -ENOMEM;