Re: [Patch v2 5/5] RDMA/mana_ib : Query adapter capabilities

Simon Horman
2023-07-26T12:32:01Z

On Tue, Jul 25, 2023 at 08:57:00PM -0700, sharmaajay@linuxonhyperv.com wrote:

...

> diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c

...

> +int mana_ib_query_adapter_caps(struct mana_ib_dev *mib_dev)
> +{
> + struct mana_ib_query_adapter_caps_resp resp = {};
> + struct mana_ib_query_adapter_caps_req req = {};
> + int err;
> +
> + mana_gd_init_req_hdr(&req.hdr, MANA_IB_GET_ADAPTER_CAP, sizeof(req),
> + sizeof(resp));
> + req.hdr.resp.msg_version = MANA_IB__GET_ADAPTER_CAP_RESPONSE_V3;
> + req.hdr.dev_id = mib_dev->gc->mana_ib.dev_id;
> +
> + err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req,
> + sizeof(resp), &resp);
> +
> + if (err) {
> + ibdev_err(&mib_dev->ib_dev, "Failed to query adapter caps err %d", err);
> + return err;
> + }
> +
> + memcpy(&mib_dev->adapter_caps, &resp.max_sq_id,
> + sizeof(mib_dev->adapter_caps));

Hi Ajay,

The indentation of the line above is off.

memcpy(&mib_dev->adapter_caps, &resp.max_sq_id,
sizeof(mib_dev->adapter_caps));

But, perhaps more importantly, an x86_64 allmodconfig W=1 build with gcc-12
yields:

In file included from ./include/linux/string.h:254,
from ./include/linux/bitmap.h:11,
from ./include/linux/ethtool.h:16,
from ./include/rdma/ib_verbs.h:15,
from drivers/infiniband/hw/mana/mana_ib.h:9,
from drivers/infiniband/hw/mana/main.c:6:
In function 'fortify_memcpy_chk',
inlined from 'mana_ib_query_adapter_caps' at drivers/infiniband/hw/mana/main.c:626:2:
./include/linux/fortify-string.h:592:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
592 | __read_overflow2_field(q_size_field, size);
|

> + return 0;
> +}

...