* re: staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs
@ 2015-11-24 12:57 Dan Carpenter
2015-11-24 14:09 ` Marciniszyn, Mike
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-11-24 12:57 UTC (permalink / raw)
To: mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hello Mike Marciniszyn,
The patch d7b8ba5121e8: "staging/rdma/hfi1: pre-compute sc and sde
for RC/UC QPs" from Nov 9, 2015, leads to the following static
checker warning:
drivers/staging/rdma/hfi1/verbs.c:1657 ah_to_sc()
error: buffer overflow 'ibp->sl_to_sc' 32 <= 255
drivers/staging/rdma/hfi1/qp.c
817 if (attr_mask & IB_QP_PATH_MIG_STATE) {
818 qp->s_mig_state = attr->path_mig_state;
819 if (mig) {
820 qp->remote_ah_attr = qp->alt_ah_attr;
821 qp->port_num = qp->alt_ah_attr.port_num;
822 qp->s_pkey_index = qp->s_alt_pkey_index;
823 qp->s_flags |= HFI1_S_AHG_CLEAR;
824 qp->s_sc = ah_to_sc(ibqp->device, &qp->remote_ah_attr);
Do we need to verify (hfi1_check_ah(ibqp->device, &qp->remote_ah_attr))
before calling ah_to_sc()?
825 qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc);
826 }
827 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs
2015-11-24 12:57 staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs Dan Carpenter
@ 2015-11-24 14:09 ` Marciniszyn, Mike
2015-11-24 21:12 ` Marciniszyn, Mike
2015-11-24 21:20 ` Marciniszyn, Mike
2 siblings, 0 replies; 4+ messages in thread
From: Marciniszyn, Mike @ 2015-11-24 14:09 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
> The patch d7b8ba5121e8: "staging/rdma/hfi1: pre-compute sc and sde for
> RC/UC QPs" from Nov 9, 2015, leads to the following static checker warning:
>
> drivers/staging/rdma/hfi1/verbs.c:1657 ah_to_sc()
> error: buffer overflow 'ibp->sl_to_sc' 32 <= 255
>
> drivers/staging/rdma/hfi1/qp.c
> 817 if (attr_mask & IB_QP_PATH_MIG_STATE) {
> 818 qp->s_mig_state = attr->path_mig_state;
> 819 if (mig) {
> 820 qp->remote_ah_attr = qp->alt_ah_attr;
> 821 qp->port_num = qp->alt_ah_attr.port_num;
> 822 qp->s_pkey_index = qp->s_alt_pkey_index;
> 823 qp->s_flags |= HFI1_S_AHG_CLEAR;
> 824 qp->s_sc = ah_to_sc(ibqp->device, &qp-
> >remote_ah_attr);
>
> Do we need to verify (hfi1_check_ah(ibqp->device, &qp->remote_ah_attr))
> before calling ah_to_sc()?
>
Looking at this now.
What was the static checker? Is it available for us to add to our testing?
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs
2015-11-24 12:57 staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs Dan Carpenter
2015-11-24 14:09 ` Marciniszyn, Mike
@ 2015-11-24 21:12 ` Marciniszyn, Mike
2015-11-24 21:20 ` Marciniszyn, Mike
2 siblings, 0 replies; 4+ messages in thread
From: Marciniszyn, Mike @ 2015-11-24 21:12 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
> drivers/staging/rdma/hfi1/qp.c
> 817 if (attr_mask & IB_QP_PATH_MIG_STATE) {
> 818 qp->s_mig_state = attr->path_mig_state;
> 819 if (mig) {
> 820 qp->remote_ah_attr = qp->alt_ah_attr;
> 821 qp->port_num = qp->alt_ah_attr.port_num;
> 822 qp->s_pkey_index = qp->s_alt_pkey_index;
> 823 qp->s_flags |= HFI1_S_AHG_CLEAR;
> 824 qp->s_sc = ah_to_sc(ibqp->device, &qp-
> >remote_ah_attr);
>
> Do we need to verify (hfi1_check_ah(ibqp->device, &qp->remote_ah_attr))
> before calling ah_to_sc()?
>
The modify code validates the IB_QP_ALT_PATH above:
647 if (attr_mask & IB_QP_ALT_PATH) {
648 u8 sc;
649
650 if (attr->alt_ah_attr.dlid >= HFI1_MULTICAST_LID_BASE)
651 goto inval;
652 if (hfi1_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
653 goto inval;
654 if (attr->alt_pkey_index >= hfi1_get_npkeys(dd))
655 goto inval;
656 sc = ah_to_sc(ibqp->device, &attr->alt_ah_attr);
657 if (!qp_to_sdma_engine(qp, sc) &&
658 dd->flags & HFI1_HAS_SEND_DMA)
659 goto inval;
660 }
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs
2015-11-24 12:57 staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs Dan Carpenter
2015-11-24 14:09 ` Marciniszyn, Mike
2015-11-24 21:12 ` Marciniszyn, Mike
@ 2015-11-24 21:20 ` Marciniszyn, Mike
2 siblings, 0 replies; 4+ messages in thread
From: Marciniszyn, Mike @ 2015-11-24 21:20 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
> > drivers/staging/rdma/hfi1/qp.c
> > 817 if (attr_mask & IB_QP_PATH_MIG_STATE) {
> > 818 qp->s_mig_state = attr->path_mig_state;
> > 819 if (mig) {
> > 820 qp->remote_ah_attr = qp->alt_ah_attr;
> > 821 qp->port_num = qp->alt_ah_attr.port_num;
> > 822 qp->s_pkey_index = qp->s_alt_pkey_index;
> > 823 qp->s_flags |= HFI1_S_AHG_CLEAR;
> > 824 qp->s_sc = ah_to_sc(ibqp->device, &qp-
> > >remote_ah_attr);
> >
> > Do we need to verify (hfi1_check_ah(ibqp->device,
> > &qp->remote_ah_attr)) before calling ah_to_sc()?
> >
>
> The modify code validates the IB_QP_ALT_PATH above:
> 647 if (attr_mask & IB_QP_ALT_PATH) {
> 648 u8 sc;
> 649
> 650 if (attr->alt_ah_attr.dlid >= HFI1_MULTICAST_LID_BASE)
> 651 goto inval;
> 652 if (hfi1_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
> 653 goto inval;
> 654 if (attr->alt_pkey_index >= hfi1_get_npkeys(dd))
> 655 goto inval;
> 656 sc = ah_to_sc(ibqp->device, &attr->alt_ah_attr);
> 657 if (!qp_to_sdma_engine(qp, sc) &&
> 658 dd->flags & HFI1_HAS_SEND_DMA)
> 659 goto inval;
> 660 }
>
I should point out the the IB core insures these two attributes are present in the same modify.
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-24 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 12:57 staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs Dan Carpenter
2015-11-24 14:09 ` Marciniszyn, Mike
2015-11-24 21:12 ` Marciniszyn, Mike
2015-11-24 21:20 ` Marciniszyn, Mike
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.