Message ID | 1473109698-31408-10-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 9/6/2016 12:07 AM, Jason Gunthorpe wrote: > gcc 6.4 remarks: > > ../providers/mlx5/cq.c:647:10: warning: 'wc_byte_len' may be used uninitialized in this function [-Wmaybe-uninitialized] > err = mlx5_copy_to_send_wqe(mqp, wqe_ctr, cqe, > lazy ? wc_byte_len : wc->byte_len); > The path is because handle_good_req_lazy does not set its wc_byte_len > outputs under certain case conditions. wc_byte_len defined as uint32_t uninitialized_var(wc_byte_len) to prevent this warning, isn't this macro applicable ? > Perhaps it is possible that the hardware never produces a completion > with opcodes and scatter flags that could trigger this, It can't happen, no real functional issue. > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > --- > libmlx5/src/cq.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libmlx5/src/cq.c b/libmlx5/src/cq.c > index 88097037eea0..163205bddeb8 100644 > --- a/libmlx5/src/cq.c > +++ b/libmlx5/src/cq.c > @@ -235,7 +235,10 @@ static inline void handle_good_req_lazy(struct mlx5_cqe64 *cqe, uint32_t *pwc_by > break; > case MLX5_OPCODE_UMR: > *umr_opcode = wq->wr_data[idx]; > + *pwc_byte_len = 0; This case is a data path flow, need to prevent adding non applicable code. > break; > + default: > + *pwc_byte_len = 0; > } > } > > -- 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/libmlx5/src/cq.c b/libmlx5/src/cq.c index 88097037eea0..163205bddeb8 100644 --- a/libmlx5/src/cq.c +++ b/libmlx5/src/cq.c @@ -235,7 +235,10 @@ static inline void handle_good_req_lazy(struct mlx5_cqe64 *cqe, uint32_t *pwc_by break; case MLX5_OPCODE_UMR: *umr_opcode = wq->wr_data[idx]; + *pwc_byte_len = 0; break; + default: + *pwc_byte_len = 0; } }
gcc 6.4 remarks: ../providers/mlx5/cq.c:647:10: warning: 'wc_byte_len' may be used uninitialized in this function [-Wmaybe-uninitialized] err = mlx5_copy_to_send_wqe(mqp, wqe_ctr, cqe, lazy ? wc_byte_len : wc->byte_len); The path is because handle_good_req_lazy does not set its wc_byte_len outputs under certain case conditions. Perhaps it is possible that the hardware never produces a completion with opcodes and scatter flags that could trigger this, but gcc is not wrong, so zero the field rather than hide the warning. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> --- libmlx5/src/cq.c | 3 +++ 1 file changed, 3 insertions(+)