> > @@ -577,12 +577,19 @@ static bool hvs_dgram_allow(u32 cid, u32 port) > > static int hvs_update_recv_data(struct hvsock *hvs) > > { > > struct hvs_recv_buf *recv_buf; > > - u32 payload_len; > > + u32 pkt_len, payload_len; > > + > > + pkt_len = hv_pkt_len(hvs->recv_desc); > > + > > + /* Ensure the packet is big enough to read its header */ > > + if (pkt_len < HVS_HEADER_LEN) > > + return -EIO; > > > > recv_buf = (struct hvs_recv_buf *)(hvs->recv_desc + 1); > > payload_len = recv_buf->hdr.data_size; > > > > - if (payload_len > HVS_MTU_SIZE) > > + /* Ensure the packet is big enough to read its payload */ > > + if (payload_len > pkt_len - HVS_HEADER_LEN || payload_len > HVS_MTU_SIZE) > > checkpatch warns that we exceed 80 characters, I do not have a strong > opinion on this, but if you have to resend better break the condition into 2 > lines. Will break if preferred. (but does it really warn?? I understand that the warning was deprecated and the "limit" increased to 100 chars...) > Maybe even update or remove the comment? (it only describes the first > condition, but the conditions are pretty clear, so I don't think it adds > much). Works for me. (taking it as this applies to the previous comment too.) Thanks, Andrea