Re: [PATCH][next] RDMA/mlx4: Copy union directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 15, 2023 at 02:39:53PM -0600, Gustavo A. R. Silva wrote:
> Copy union directly instead of using memcpy().
> 
> Note that in this case, a direct assignment is more readable and
> consistent with the subsequent assignments.
> 
> This addresses the following -Wstringop-overflow warning seen in s390
> with defconfig:
> drivers/infiniband/hw/mlx4/main.c:296:33: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
>   296 |                                 memcpy(&port_gid_table->gids[free].gid,
>       |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   297 |                                        &attr->gid, sizeof(attr->gid));
>       |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hm, why did it think the union had a size of 0?

Regardless, it's a nice fix:

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

-- 
Kees Cook



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux