From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Rui Xiang <rui.xiang@huawei.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysfs: add necessary Null check in sysfs_do_create_link_sd
Date: Mon, 2 Dec 2013 18:47:26 -0800 [thread overview]
Message-ID: <20131203024726.GC23997@kroah.com> (raw)
In-Reply-To: <529D3627.1000205@huawei.com>
On Tue, Dec 03, 2013 at 09:38:47AM +0800, Rui Xiang wrote:
> While target_sd or sd are null, it won't need sysfs_put and
> should return -ENOENT directly. Here add null check for
> target_sd and sd.
>
> Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
> ---
> fs/sysfs/symlink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
> index 3ae3f1b..d69b786 100644
> --- a/fs/sysfs/symlink.c
> +++ b/fs/sysfs/symlink.c
> @@ -83,8 +83,10 @@ static int sysfs_do_create_link_sd(struct sysfs_dirent *parent_sd,
> return 0;
>
> out_put:
> - sysfs_put(target_sd);
> - sysfs_put(sd);
> + if (target_sd)
> + sysfs_put(target_sd);
> + if (sd)
> + sysfs_put(sd);
This change does nothing at all, why is it needed?
greg k-h
next prev parent reply other threads:[~2013-12-03 2:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 1:38 [PATCH] sysfs: add necessary Null check in sysfs_do_create_link_sd Rui Xiang
2013-12-03 2:47 ` Greg Kroah-Hartman [this message]
2013-12-03 3:08 ` Rui Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131203024726.GC23997@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rui.xiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.