lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 15 Dec 2011 11:48:13 +0300
From:	Dan Carpenter <>
To:	Yevgeny Petrilin <>
Subject: mlx4: smatch stuff: saving error codes in u8

Hi Yevgeny,

Smatch complains about some recent changes to the mlx4 driver:
drivers/net/ethernet/mellanox/mlx4/cmd.c +364 mlx4_slave_cmd(27)
	warn: assigning -22 to unsigned variable 'vhcr->status'

   361                                          mlx4_err(dev, "response expected while"
   362                                                   "output mailbox is NULL for "
   363                                                   "command 0x%x\n", op);
   364                                          vhcr->status = -EINVAL;
This is supposed to store some hardware specific error codes.  -EINVAL
should be CMD_STAT_BAD_PARAM.  Saving negative numbers to unsigned char
doesn't work.

   365                                  }
   366                          }
   367                          ret = vhcr->status;
We should be using the mlx4_status_to_errno() function here to translate
the hardware error codes to linux error codes.

Also "ret" here gets passed to the the callers who again save it to
vhcr_cmd->status = __mlx4_cmd() in mlx4_master_process_vhcr().  The
__mlx4_cmd() function only returns linux error codes, not hardware error

Also the mlx4_master_process_vhcr() function sets vhcr_cmd->status to
linux error codes (which is a mistake) but it doesn't set "ret" on all
paths so it sometimes returns success even though an error occured
(which is a second separate mistake).

dan carpenter

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists