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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdn3_xXm09V8PPdfwkV7CMxGDxgODK3an3HuPiRBBzGM1w@mail.gmail.com>
Date:   Mon, 4 Mar 2019 10:16:41 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Louis Taylor <louis@...gniz.eu>
Cc:     jdelvare@...e.com, linux-i2c@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux@...glegroups.com,
        Jon Flatley <jflat@...omium.org>
Subject: Re: [PATCH] i2c: sis630: correct format strings

On Sat, Mar 2, 2019 at 6:19 AM Louis Taylor <louis@...gniz.eu> wrote:
>
> When compiling with -Wformat, clang warns:
>
> drivers/i2c/busses/i2c-sis630.c:482:4: warning: format specifies type
>       'unsigned short' but the argument has type 'int' [-Wformat]
>                         smbus_base + SMB_STS,
>                         ^~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:483:4: warning: format specifies type
>       'unsigned short' but the argument has type 'int' [-Wformat]
>                         smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/i2c/busses/i2c-sis630.c:531:37: warning: format specifies type
>       'unsigned short' but the argument has type 'int' [-Wformat]
>                  "SMBus SIS630 adapter at %04hx", smbus_base + SMB_STS);
>                                           ~~~~~   ^~~~~~~~~~~~~~~~~~~~
>
> This patch fixes the format strings to use the format type for int.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@...gniz.eu>
> ---
>  drivers/i2c/busses/i2c-sis630.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
> index 1e6805b5cef2..a57aa4fe51a4 100644
> --- a/drivers/i2c/busses/i2c-sis630.c
> +++ b/drivers/i2c/busses/i2c-sis630.c
> @@ -478,7 +478,7 @@ static int sis630_setup(struct pci_dev *sis630_dev)
>         if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,
>                             sis630_driver.name)) {
>                 dev_err(&sis630_dev->dev,
> -                       "I/O Region 0x%04hx-0x%04hx for SMBus already in use.\n",
> +                       "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
>                         smbus_base + SMB_STS,

Even additions with 0x00 imply integer promotions (my least favorite part of C).
Thanks for the cleanup.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ