+Cc Vadim, David. On 9/28/23 14:23, Dan Carpenter wrote: > Hello Liming Sun, > > The patch bc05ea63b394: "platform/mellanox: Add BlueField-3 support > in the tmfifo driver" from Oct 18, 2022 (linux-next), leads to the > following Smatch static checker warning: > > drivers/platform/mellanox/mlxbf-tmfifo.c:634 mlxbf_tmfifo_rxtx_word() > error: uninitialized symbol 'data'. Dan as always thank you for reporting this. Liming, David, Vadim, Can one of you take a look at this please ? Regards, Hans > > drivers/platform/mellanox/mlxbf-tmfifo.c > 592 static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, > 593 struct vring_desc *desc, > 594 bool is_rx, int len) > 595 { > 596 struct virtio_device *vdev = vring->vq->vdev; > 597 struct mlxbf_tmfifo *fifo = vring->fifo; > 598 void *addr; > 599 u64 data; > 600 > 601 /* Get the buffer address of this desc. */ > 602 addr = phys_to_virt(virtio64_to_cpu(vdev, desc->addr)); > 603 > 604 /* Read a word from FIFO for Rx. */ > 605 if (is_rx) > 606 data = readq(fifo->rx.data); > 607 > 608 if (vring->cur_len + sizeof(u64) <= len) { > 609 /* The whole word. */ > 610 if (!IS_VRING_DROP(vring)) { > 611 if (is_rx) > 612 memcpy(addr + vring->cur_len, &data, > 613 sizeof(u64)); > 614 else > 615 memcpy(&data, addr + vring->cur_len, > 616 sizeof(u64)); > 617 } > > if IS_VRING_DROP() is true then data isn't intialized. > > 618 vring->cur_len += sizeof(u64); > 619 } else { > 620 /* Leftover bytes. */ > 621 if (!IS_VRING_DROP(vring)) { > 622 if (is_rx) > 623 memcpy(addr + vring->cur_len, &data, > 624 len - vring->cur_len); > 625 else > 626 memcpy(&data, addr + vring->cur_len, > 627 len - vring->cur_len); > 628 } > > Same here. > > 629 vring->cur_len = len; > 630 } > 631 > 632 /* Write the word into FIFO for Tx. */ > 633 if (!is_rx) > --> 634 writeq(data, fifo->tx.data); > ^^^^ > Unitialized if IS_VRING_DROP() is true. > > 635 } > > regards, > dan carpenter >