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]
Date:   Tue, 5 Jun 2018 18:31:42 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
Cc:     kbuild test robot <lkp@...el.com>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        kbuild-all@...org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: include/linux/string.h:246:9: warning: '__builtin_strncpy' output
 truncated before terminating nul copying 4 bytes from a string of the same length

On Tue, Jun 5, 2018 at 6:30 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> On Tue, Jun 05, 2018 at 06:19:07PM +0300, Andy Shevchenko wrote:
>> On Tue, May 29, 2018 at 4:35 AM, kbuild test robot <lkp@...el.com> wrote:
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > head:   786b71f5b754273ccef6d9462e52062b3e1f9877
>> > commit: 854e55ad289ef8888e7991f0ada85d5846f5afb9 objtool, perf: Fix GCC 8 -Wrestrict error
>> > date:   2 months ago
>> > config: x86_64-randconfig-s4-05290856 (attached as .config)
>> > compiler: gcc-8 (Debian 8.1.0-3) 8.1.0
>> > reproduce:
>> >         git checkout 854e55ad289ef8888e7991f0ada85d5846f5afb9
>> >         # save the attached .config to linux build tree
>> >         make ARCH=x86_64
>> >
>>
>> I guess it's easy to fix by
>>
>> --- a/drivers/video/fbdev/uvesafb.c
>> +++ b/drivers/video/fbdev/uvesafb.c
>> @@ -422,7 +422,7 @@ static int uvesafb_vbe_getinfo(struct uvesafb_ktask *task,
>>        task->t.flags = TF_VBEIB;
>>        task->t.buf_len = sizeof(struct vbe_ib);
>>        task->buf = &par->vbe_ib;
>> -       strncpy(par->vbe_ib.vbe_signature, "VBE2", 4);
>> +       snprintf(par->vbe_ib.vbe_signature,
>> sizeof(par->vbe_ib.vbe_signature), "VBE2");
>>
>> The question is do we want this to just shut up a compiler? It's
>> obviously false positive.
>
> What about just changing it to a memcpy?  Seems like that would be
> cleaner anyway, since the whole point of strncpy is to add the
> terminating NULL, which isn't need here.

Agree.

Btw, Bartlomiej, it seems driver maintainer's address is bouncing.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ