* [bug report] RDMA/hns: Add support for XRC on HIP09
@ 2021-03-18 13:14 Dan Carpenter
2021-03-19 1:54 ` liweihang
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-03-18 13:14 UTC (permalink / raw)
To: liangwenpeng; +Cc: linux-rdma
Hello Wenpeng Liang,
The patch 32548870d438: "RDMA/hns: Add support for XRC on HIP09" from
Mar 4, 2021, leads to the following static checker warning:
drivers/infiniband/hw/hns/hns_roce_pd.c:143 hns_roce_xrcd_alloc()
warn: passing casted pointer 'xrcdn' to 'hns_roce_bitmap_alloc()' 32 vs 64.
drivers/infiniband/hw/hns/hns_roce_pd.c
141 static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn)
142 {
143 return hns_roce_bitmap_alloc(&hr_dev->xrcd_bitmap,
144 (unsigned long *)xrcdn);
The hns_roce_bitmap_alloc() is going to write a ulong to &xrcd->xrcdn
so this will lead to memory corruption.
145 }
146
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] RDMA/hns: Add support for XRC on HIP09
2021-03-18 13:14 [bug report] RDMA/hns: Add support for XRC on HIP09 Dan Carpenter
@ 2021-03-19 1:54 ` liweihang
0 siblings, 0 replies; 2+ messages in thread
From: liweihang @ 2021-03-19 1:54 UTC (permalink / raw)
To: Dan Carpenter, liangwenpeng; +Cc: linux-rdma@vger.kernel.org
On 2021/3/18 21:15, Dan Carpenter wrote:
> Hello Wenpeng Liang,
>
> The patch 32548870d438: "RDMA/hns: Add support for XRC on HIP09" from
> Mar 4, 2021, leads to the following static checker warning:
>
> drivers/infiniband/hw/hns/hns_roce_pd.c:143 hns_roce_xrcd_alloc()
> warn: passing casted pointer 'xrcdn' to 'hns_roce_bitmap_alloc()' 32 vs 64.
>
> drivers/infiniband/hw/hns/hns_roce_pd.c
> 141 static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn)
> 142 {
> 143 return hns_roce_bitmap_alloc(&hr_dev->xrcd_bitmap,
> 144 (unsigned long *)xrcdn);
>
> The hns_roce_bitmap_alloc() is going to write a ulong to &xrcd->xrcdn
> so this will lead to memory corruption.
>
> 145 }
> 146
>
> regards,
> dan carpenter
>
Hi Dan,
Thanks for your reminder, we fill fix it ASAP.
Weihang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 1:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-18 13:14 [bug report] RDMA/hns: Add support for XRC on HIP09 Dan Carpenter
2021-03-19 1:54 ` liweihang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox