Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: lixiaokeng <lixiaokeng@huawei.com>
Cc: Jes Sorensen <jes@trained-monkey.org>,
	Paul Menzel <pmenzel@molgen.mpg.de>, <linux-raid@vger.kernel.org>,
	linfeilong <linfeilong@huawei.com>,
	"liuzhiqiang (I)" <liuzhiqiang26@huawei.com>,
	Wu Guanghao <wuguanghao3@huawei.com>
Subject: Re: [PATCH V3] Fix NULL dereference in super_by_fd
Date: Wed, 21 Dec 2022 09:18:10 +0100	[thread overview]
Message-ID: <20221221091810.000072c9@linux.intel.com> (raw)
In-Reply-To: <44edac17-12c8-a512-3d27-f2f22e82b990@huawei.com>


>  			*subarrayp = subarray;
>  		strcpy(st->container_devnm, container);
> -		strcpy(st->devnm, fd2devnm(fd));
> +		strncpy(st->devnm, devnm, MD_NAME_MAX);

Sorry for bothering you again but there is one nit. Strncpy implementation
doesn't guarantee '\0' ended string- static code analysis may warn. In this
case you can use:
strncpy(st->devnm, devnm, MD_NAME_MAX - 1);
or
snprintf(st->devnm, MD_NAME_MAX, "%s", devnm);

Thanks,
Mariusz

  reply	other threads:[~2022-12-21  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 11:27 [PATCH V3] Fix NULL dereference in super_by_fd lixiaokeng
2022-12-21  8:18 ` Mariusz Tkaczyk [this message]
2022-12-21  9:03 ` Paul Menzel
  -- strict thread matches above, loose matches on Subject: below --
2022-12-19 12:22 lixiaokeng

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=20221221091810.000072c9@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=lixiaokeng@huawei.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=wuguanghao3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox