[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210528215130.19523600@oasis.local.home>
Date:   Fri, 28 May 2021 21:51:30 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Dietmar Eggemann <dietmar.eggemann@....com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Valentin Schneider <valentin.schneider@....com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] debugfs: Fix debugfs_read_file_str()
On Thu, 27 May 2021 11:11:05 +0200
Dietmar Eggemann <dietmar.eggemann@....com> wrote:
> +++ b/fs/debugfs/file.c
> @@ -893,7 +893,7 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf,
>  
>  	copy[copy_len] = '\n';
>  
> -	ret = simple_read_from_buffer(user_buf, count, ppos, copy, copy_len);
> +	ret = simple_read_from_buffer(user_buf, count, ppos, copy, len);
>  	kfree(copy);
As we have:
	len = strlen(str) + 1;
	[..]
	copy_len = strscpy(copy, str, len);
I can't think of any situation that len is not equal to copy_len + 1. :-/
Anyway, either "len" or "copy_len + 1" would work.
Reviewed-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
-- Steve
Powered by blists - more mailing lists