Message ID | 1521466567-177019-1-git-send-email-liuyixian@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
On Mon, Mar 19, 2018 at 09:36:07PM +0800, Yixian Liu wrote: > The data in resp will be copied from kernel to userspace, > thus it needs to be intialized to zeros. This bug is reported > by dan carpenter. It is imported by following patch. > > Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) > > Signed-off-by: Yixian Liu <liuyixian@huawei.com> Hi, There are two small things: 1. Extra space line between fixes and Signed-off-by. 2. No " in fixes line. Add this line to you [alias] section of gitconfig fixes = log --abbrev=12 -1 --format='Fixes: %h (\"%s\")' and it will create canonical Fixes line for any supplied commit SHA. ➜ kernel git:(rdma-next) git fixes e088a685eae9 Fixes: e088a685eae9 ("RDMA/hns: Support rq record doorbell for the user space") Thanks > --- > drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c > index e1ee666..6e48b1f 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_main.c > +++ b/drivers/infiniband/hw/hns/hns_roce_main.c > @@ -338,7 +338,7 @@ static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev, > { > int ret = 0; > struct hns_roce_ucontext *context; > - struct hns_roce_ib_alloc_ucontext_resp resp; > + struct hns_roce_ib_alloc_ucontext_resp resp = {}; > struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); > > resp.qp_tab_size = hr_dev->caps.num_qps; > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Mar 19, 2018 at 09:36:07PM +0800, Yixian Liu wrote: > The data in resp will be copied from kernel to userspace, > thus it needs to be intialized to zeros. This bug is reported > by dan carpenter. It is imported by following patch. > > Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) > > Signed-off-by: Yixian Liu <liuyixian@huawei.com> > drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, to for-next, but I modified the commit message as Leon noted and added a Reported-by for Dan. Pease follow this pattern in future: commit df7e40425813c50cd252e6f5e348a81ef1acae56 (HEAD -> k.o/for-next) Author: Yixian Liu <liuyixian@huawei.com> Date: Mon Mar 19 21:36:07 2018 +0800 RDMA/hns: Fix init resp when alloc ucontext The data in resp will be copied from kernel to userspace, thus it needs to be initialized to zeros to avoid copying uninited stack memory. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: e088a685eae9 ("RDMA/hns: Support rq record doorbell for the user space") Signed-off-by: Yixian Liu <liuyixian@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Thanks, Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2018/3/19 22:01, Leon Romanovsky wrote: > On Mon, Mar 19, 2018 at 09:36:07PM +0800, Yixian Liu wrote: >> The data in resp will be copied from kernel to userspace, >> thus it needs to be intialized to zeros. This bug is reported >> by dan carpenter. It is imported by following patch. >> >> Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) >> >> Signed-off-by: Yixian Liu <liuyixian@huawei.com> > > Hi, > > There are two small things: > 1. Extra space line between fixes and Signed-off-by. > 2. No " in fixes line. > > Add this line to you [alias] section of gitconfig > > fixes = log --abbrev=12 -1 --format='Fixes: %h (\"%s\")' > > and it will create canonical Fixes line for any supplied commit SHA. > > ➜ kernel git:(rdma-next) git fixes e088a685eae9 > Fixes: e088a685eae9 ("RDMA/hns: Support rq record doorbell for the user space") > > Thanks > Hi, Leon, thanks for your useful information! >> --- >> drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c >> index e1ee666..6e48b1f 100644 >> --- a/drivers/infiniband/hw/hns/hns_roce_main.c >> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c >> @@ -338,7 +338,7 @@ static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev, >> { >> int ret = 0; >> struct hns_roce_ucontext *context; >> - struct hns_roce_ib_alloc_ucontext_resp resp; >> + struct hns_roce_ib_alloc_ucontext_resp resp = {}; >> struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); >> >> resp.qp_tab_size = hr_dev->caps.num_qps; >> -- >> 1.9.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2018/3/20 1:51, Jason Gunthorpe wrote: > On Mon, Mar 19, 2018 at 09:36:07PM +0800, Yixian Liu wrote: >> The data in resp will be copied from kernel to userspace, >> thus it needs to be intialized to zeros. This bug is reported >> by dan carpenter. It is imported by following patch. >> >> Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) >> >> Signed-off-by: Yixian Liu <liuyixian@huawei.com> >> drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > Applied, to for-next, but I modified the commit message as Leon noted > and added a Reported-by for Dan. Pease follow this pattern in future: > > commit df7e40425813c50cd252e6f5e348a81ef1acae56 (HEAD -> k.o/for-next) > Author: Yixian Liu <liuyixian@huawei.com> > Date: Mon Mar 19 21:36:07 2018 +0800 > > RDMA/hns: Fix init resp when alloc ucontext > > The data in resp will be copied from kernel to userspace, thus it needs to > be initialized to zeros to avoid copying uninited stack memory. > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Fixes: e088a685eae9 ("RDMA/hns: Support rq record doorbell for the user space") > Signed-off-by: Yixian Liu <liuyixian@huawei.com> > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> > > Thanks, > Jason > Hi Jason, Thanks a lot for your much clearer description! I will follow this pattern. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index e1ee666..6e48b1f 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -338,7 +338,7 @@ static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev, { int ret = 0; struct hns_roce_ucontext *context; - struct hns_roce_ib_alloc_ucontext_resp resp; + struct hns_roce_ib_alloc_ucontext_resp resp = {}; struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); resp.qp_tab_size = hr_dev->caps.num_qps;
The data in resp will be copied from kernel to userspace, thus it needs to be intialized to zeros. This bug is reported by dan carpenter. It is imported by following patch. Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) Signed-off-by: Yixian Liu <liuyixian@huawei.com> --- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)