On 02/07/2019 16:06, Leon Romanovsky wrote:
On Tue, Jul 02, 2019 at 03:49:28PM +0200, Maksym Planeta wrote:
In some cases (not in this particular one) variable self-initialization
can lead to undefined behavior. In this case, it is just obscure code.
Signed-off-by: Maksym Planeta <mplaneta@xxxxxxxxxxxxxxxxxxxx>
---
drivers/infiniband/sw/rxe/rxe_comp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
index 00eb99d3df86..116cafc9afcf 100644
--- a/drivers/infiniband/sw/rxe/rxe_comp.c
+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
@@ -558,7 +558,7 @@ int rxe_completer(void *arg)
{
struct rxe_qp *qp = (struct rxe_qp *)arg;
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
- struct rxe_send_wqe *wqe = wqe;
+ struct rxe_send_wqe *wqe = NULL;
This can't work, for example call to do_read() will crash the system,
due to pointer dereference.
wqe will be properly initialized before actual usage.
Before do_read can be called, first there is necessary COMPST_GET_ACK,
and then necessary COMPST_GET_WQE. Then get_wqe will be called, that
sets proper value for wqe.
struct sk_buff *skb = NULL;
struct rxe_pkt_info *pkt = NULL;
enum comp_state state;
--
2.20.1
--
Regards,
Maksym Planeta