[bug report] infiniband/hw/mthca: ancient uninitialized variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ This code is very old, but it's also very obviously buggy.  Does
  anyone know what a good default "out =" value should be? - dan ]

Hello Linus Torvalds,

The patch 1da177e4c3f4: "Linux-2.6.12-rc2" from Apr 16, 2005
(linux-next), leads to the following Smatch static checker warning:

	drivers/infiniband/hw/mthca/mthca_cmd.c:644 mthca_SYS_EN()
	error: uninitialized symbol 'out'.

drivers/infiniband/hw/mthca/mthca_cmd.c
    636 int mthca_SYS_EN(struct mthca_dev *dev)
    637 {
    638         u64 out;
    639         int ret;
    640 
    641         ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, CMD_TIME_CLASS_D);

We pass out here and it gets used without being initialized.

        err = mthca_cmd_post(dev, in_param,
                             out_param ? *out_param : 0,
                                         ^^^^^^^^^^
                             in_modifier, op_modifier,
                             op, context->token, 1);

It's the same in mthca_cmd_wait() and mthca_cmd_poll().

    642 
    643         if (ret == -ENOMEM)
--> 644                 mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, "
    645                            "sladdr=%d, SPD source=%s\n",
    646                            (int) (out >> 6) & 0xf, (int) (out >> 4) & 3,
    647                            (int) (out >> 1) & 7, (int) out & 1 ? "NVMEM" : "DIMM");
    648 
    649         return ret;
    650 }

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux