[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57153833.7060809@hpe.com>
Date: Mon, 18 Apr 2016 15:40:35 -0400
From: Waiman Long <waiman.long@....com>
To: Davidlohr Bueso <dave@...olabs.net>
CC: <mingo@...nel.org>, <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH -tip 3/3] locking/pvqspinlock: Robustify init_qspinlock_stat()
On 04/18/2016 02:31 AM, Davidlohr Bueso wrote:
> Specifically around the debugfs file creation calls,
> I have no idea if they could ever possibly fail, but
> this is core code (debug aside) so lets at least
> check the return value and inform anything fishy.
>
> Signed-off-by: Davidlohr Bueso<dbueso@...e.de>
> ---
> kernel/locking/qspinlock_stat.h | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/locking/qspinlock_stat.h b/kernel/locking/qspinlock_stat.h
> index 72722334237a..ddcd653c942c 100644
> --- a/kernel/locking/qspinlock_stat.h
> +++ b/kernel/locking/qspinlock_stat.h
> @@ -225,12 +225,18 @@ static int __init init_qspinlock_stat(void)
> * performance.
> */
> for (i = 0; i< qstat_num; i++)
> - debugfs_create_file(qstat_names[i], 0400, d_qstat,
> - (void *)(long)i,&fops_qstat);
> + if (!debugfs_create_file(qstat_names[i], 0400, d_qstat,
> + (void *)(long)i,&fops_qstat))
> + goto fail;
> +
> + if (!debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat,
> + (void *)(long)qstat_reset_cnts,&fops_qstat))
> + goto fail;
>
> - debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat,
> - (void *)(long)qstat_reset_cnts,&fops_qstat);
> return 0;
> +fail:
> + debugfs_remove_recursive(d_qstat);
> + return 1;
> }
> fs_initcall(init_qspinlock_stat);
>
Reviewed-by: Waiman Long <Waiman.Long@....com>
Cheers,
Longman
Powered by blists - more mailing lists