From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jens Axboe <axboe@kernel.dk>
Cc: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block: bsg.c: Cleaning up missing null-terminate in conjunction with strncpy
Date: Sat, 26 Jul 2014 16:07:45 +0200 [thread overview]
Message-ID: <1406383665-1670-1-git-send-email-rickard_strandqvist@spectrumdigital.se> (raw)
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
block/bsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/bsg.c b/block/bsg.c
index ff46add..b2688c5 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -790,7 +790,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
mutex_lock(&bsg_mutex);
hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));
- strncpy(bd->name, dev_name(rq->bsg_dev.class_dev), sizeof(bd->name) - 1);
+ strlcpy(bd->name, dev_name(rq->bsg_dev.class_dev), sizeof(bd->name));
dprintk("bound to <%s>, max queue %d\n",
format_dev_t(buf, inode->i_rdev), bd->max_queue);
--
1.7.10.4
next reply other threads:[~2014-07-26 14:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-26 14:07 Rickard Strandqvist [this message]
2014-07-28 14:31 ` Jeff Moyer
2014-07-29 19:09 ` Rickard Strandqvist
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=1406383665-1670-1-git-send-email-rickard_strandqvist@spectrumdigital.se \
--to=rickard_strandqvist@spectrumdigital.se \
--cc=axboe@kernel.dk \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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®