struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);
struct device *dev = hr_dev->dev;
struct hns_roce_ib_create_cq ucmd;
- struct hns_roce_ib_create_cq_resp resp;
+ struct hns_roce_ib_create_cq_resp resp = {};
struct hns_roce_cq *hr_cq = NULL;
struct hns_roce_uar *uar = NULL;
int vector = attr->comp_vector;
}
if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) &&
- (udata->outlen == sizeof(resp))) {
+ (udata->outlen >= sizeof(resp))) {
ret = hns_roce_db_map_user(to_hr_ucontext(context),
ucmd.db_addr, &hr_cq->db);
if (ret) {
hr_cq->cq_depth = cq_entries;
if (context) {
+ resp.cqn = hr_cq->cqn;
if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) &&
- (udata->outlen == sizeof(resp))) {
+ (udata->outlen >= sizeof(resp))) {
hr_cq->db_en = 1;
- resp.cqn = hr_cq->cqn;
resp.cap_flags |= HNS_ROCE_SUPPORT_CQ_RECORD_DB;
- ret = ib_copy_to_udata(udata, &resp, sizeof(resp));
- } else
- ret = ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64));
+ }
+ ret = ib_copy_to_udata(udata, &resp, sizeof(resp));
if (ret)
goto err_dbmap;
}
err_dbmap:
if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) &&
- (udata->outlen == sizeof(resp)))
+ (udata->outlen >= sizeof(resp)))
hns_roce_db_unmap_user(to_hr_ucontext(context),
&hr_cq->db);
{
struct device *dev = hr_dev->dev;
struct hns_roce_ib_create_qp ucmd;
- struct hns_roce_ib_create_qp_resp resp;
+ struct hns_roce_ib_create_qp_resp resp = {};
unsigned long qpn = 0;
int ret = 0;
u32 page_shift;
}
if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) &&
- (udata->outlen == sizeof(resp)) &&
+ (udata->outlen >= sizeof(resp)) &&
hns_roce_qp_has_rq(init_attr)) {
ret = hns_roce_db_map_user(
to_hr_ucontext(ib_pd->uobject->context),
else
hr_qp->doorbell_qpn = cpu_to_le64(hr_qp->qpn);
- if (ib_pd->uobject && (udata->outlen == sizeof(resp)) &&
+ if (ib_pd->uobject && (udata->outlen >= sizeof(resp)) &&
(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB)) {
/* indicate kernel supports record db */
err_wrid:
if (ib_pd->uobject) {
if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) &&
- (udata->outlen == sizeof(resp)) &&
+ (udata->outlen >= sizeof(resp)) &&
hns_roce_qp_has_rq(init_attr))
hns_roce_db_unmap_user(
to_hr_ucontext(ib_pd->uobject->context),