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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Mar 2019 21:37:21 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     Dominique Martinet <asmadeus@...ewreck.org>,
        Ingo Molnar <mingo@...hat.com>, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 15/18] blktrace: change strncpy+truncation to strlcpy


Jens,

I noticed this old patch in my inbox. It looks like a legit cleanup.
Want to take it?

-- Steve


On Fri, 13 Jul 2018 03:26:02 +0200
Dominique Martinet <asmadeus@...ewreck.org> wrote:

> Using strlcpy fixes this new gcc warning:
>     kernel/trace/blktrace.c: In function ‘do_blk_trace_setup’:
>     kernel/trace/blktrace.c:497:2: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
>       strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Generated by scripts/coccinelle/misc/strncpy_truncation.cocci
> 
> Signed-off-by: Dominique Martinet <asmadeus@...ewreck.org>
> ---
> 
> Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the
> first patch of the serie) for the motivation behind this patch
> 
>  kernel/trace/blktrace.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index 987d9a9ae283..2478d9838eab 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -494,8 +494,7 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
>  	if (!buts->buf_size || !buts->buf_nr)
>  		return -EINVAL;
>  
> -	strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);
> -	buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0';
> +	strlcpy(buts->name, name, BLKTRACE_BDEV_SIZE);
>  
>  	/*
>  	 * some device names have larger paths - convert the slashes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ