From: John Johansen <john.johansen@canonical.com>
To: Li kunyu <kunyu@nfschina.com>,
paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com
Cc: apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] apparmor/file: Removing unnecessary initial values for variable pointers
Date: Thu, 28 Sep 2023 10:36:16 -0700 [thread overview]
Message-ID: <056095ad-ecf4-b93e-252a-7e3c48e94f11@canonical.com> (raw)
In-Reply-To: <20230919015608.8390-1-kunyu@nfschina.com>
On 9/18/23 18:56, Li kunyu wrote:
> These variable pointers are assigned during use and do not need to be
> initialized for assignment.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
> v2: Fix timestamp issues
>
> security/apparmor/file.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/apparmor/file.c b/security/apparmor/file.c
> index 698b124e649f..12eafdf18fc0 100644
> --- a/security/apparmor/file.c
> +++ b/security/apparmor/file.c
> @@ -264,7 +264,7 @@ int aa_path_perm(const char *op, struct aa_label *label,
> {
> struct aa_perms perms = {};
> struct aa_profile *profile;
> - char *buffer = NULL;
> + char *buffer;
this is okay
> int error;
>
> flags |= PATH_DELEGATE_DELETED | (S_ISDIR(cond->mode) ? PATH_IS_DIR :
> @@ -412,7 +412,7 @@ int aa_path_link(struct aa_label *label, struct dentry *old_dentry,
> d_backing_inode(old_dentry)->i_uid,
> d_backing_inode(old_dentry)->i_mode
> };
> - char *buffer = NULL, *buffer2 = NULL;
> + char *buffer, *buffer2;
this can cause an oops if buffer2 allocation fails. There are a couple of ways I can
see to fix this, do you want to take a crack at it.
> struct aa_profile *profile;
> int error;
>
next prev parent reply other threads:[~2023-09-28 17:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 1:56 Li kunyu
2023-09-28 17:36 ` John Johansen [this message]
2023-09-28 19:35 ` Serge E. Hallyn
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=056095ad-ecf4-b93e-252a-7e3c48e94f11@canonical.com \
--to=john.johansen@canonical.com \
--cc=apparmor@lists.ubuntu.com \
--cc=jmorris@namei.org \
--cc=kunyu@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®