]> git.ipfire.org Git - thirdparty/iproute2.git/commit
rdma: Limit copy data by the destination size
authorLeon Romanovsky <leonro@nvidia.com>
Sun, 9 Jan 2022 18:41:38 +0000 (20:41 +0200)
committerDavid Ahern <dsahern@kernel.org>
Tue, 11 Jan 2022 16:18:16 +0000 (09:18 -0700)
commitb87671681e8aa9318e30c4e646419d96f1063d23
treef067f02bb7c16d380e05ba5e68f39593082ed51a
parent44ca91ceeca3dba0ee0620ce5c346bf5dbf8917a
rdma: Limit copy data by the destination size

The strncat() function will copy upto n bytes supplied as third
argument. The n bytes shouldn't be no more than destination and
not the source.

This change fixes the following clang compilation warnings:

res-srq.c:75:25: warning: size argument in 'strncat' call appears to be size of the source [-Wstrncat-size]
                        strncat(qp_str, tmp, sizeof(tmp) - 1);
                                             ^~~~~~~~~~~~~~~
res-srq.c:99:23: warning: size argument in 'strncat' call appears to be size of the source [-Wstrncat-size]
        strncat(qp_str, tmp, sizeof(tmp) - 1);
                             ^~~~~~~~~~~~~~~
res-srq.c:142:25: warning: size argument in 'strncat' call appears to be size of the source [-Wstrncat-size]
                        strncat(qp_str, tmp, sizeof(tmp) - 1);
                                             ^~~~~~~~~~~~~~~

Fixes: 9b272e138d23 ("rdma: Add SRQ resource tracking information")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
rdma/res-srq.c