Hi Haiyang,

[I'm resuming this work by Andres.  Sorry for the delay.]


> >     switch (nvsp_packet->hdr.msg_type) {
> >     case NVSP_MSG_TYPE_INIT_COMPLETE:
> >     case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
> >     case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
> >     case NVSP_MSG5_TYPE_SUBCHANNEL:
> > +           if (msglen < sizeof(struct nvsp_message)) {
> > +                   netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
> > +                              msglen);
> > +                   return;
> > +           }
> 
> struct nvsp_message includes all message types, so its length is the longest 
> type,
> The messages from older host version are not necessarily reaching the 
> sizeof(struct nvsp_message).

I split the check above into several checks, one for each "case", using
(what I understand are) the corresponding structures/sizeofs...

> 
> Testing on both new and older hosts are recommended, in case I didn't find 
> out all issues
> like this one.

Sure, will do.

Thanks,
  Andrea

Reply via email to