lists.openwall.net   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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 6 Nov 2016 17:12:11 +0100
From:   Wim Van Sebroeck <wim@...ana.be>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     Heinrich Schuchardt <xypron.glpk@....de>,
        linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] watchdog: pcipcwd_show_card_info: wrong format string

Hi All,

> On 11/05/2016 07:50 AM, Heinrich Schuchardt wrote:
> >fw_rev_major and fw_rev_minor are defined as int.
> >Use %d to print them.
> >
> >Signed-off-by: Heinrich Schuchardt <xypron.glpk@....de>
> >---
> > drivers/watchdog/pcwd_pci.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
> >index c0d07ee..e1fbbf6 100644
> >--- a/drivers/watchdog/pcwd_pci.c
> >+++ b/drivers/watchdog/pcwd_pci.c
> >@@ -234,7 +234,7 @@ static void pcipcwd_show_card_info(void)
> > 	got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major,
> > 								&fw_rev_minor);
> > 	if (got_fw_rev)
> >-		sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
> >+		sprintf(fw_ver_str, "%d.%02d", fw_rev_major, fw_rev_minor);
> > 	else
> > 		sprintf(fw_ver_str, "<card no answer>");
> >
> >
> Hmm ... I don't think that a negative version number makes much sense.
> Turns out inb() returns a char on some architectures, meaning it is signed,
> meaning it _could_ return a negative number if the version number is 128
> or above. I don't want to risk us reporting version number -128.-110 just
> to make compilers happy.

I couldn't have said this better myself :-) version info is indeed to be consider as an unsigned int.

Kind regards,
Wim.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ