All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Efremov <efremov@linux.com>
To: linux-block@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] floppy: cleanups: use memset() to zero reply_buffer
Date: Fri, 16 Apr 2021 11:34:47 +0300	[thread overview]
Message-ID: <20210416083449.72700-4-efremov@linux.com> (raw)
In-Reply-To: <20210416083449.72700-1-efremov@linux.com>

Use memset() to zero reply buffer in raw_cmd_copyin() instead
of a for loop.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/block/floppy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index df5c32900539..c58b0b079afc 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3090,7 +3090,6 @@ static int raw_cmd_copyin(int cmd, void __user *param,
 {
 	struct floppy_raw_cmd *ptr;
 	int ret;
-	int i;
 
 	*rcmd = NULL;
 
@@ -3109,8 +3108,7 @@ static int raw_cmd_copyin(int cmd, void __user *param,
 	if (ptr->cmd_count > FD_RAW_CMD_FULLSIZE)
 		return -EINVAL;
 
-	for (i = 0; i < FD_RAW_REPLY_SIZE; i++)
-		ptr->reply[i] = 0;
+	memset(ptr->reply, 0, FD_RAW_REPLY_SIZE);
 	ptr->resultcode = 0;
 
 	if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
-- 
2.30.2


  parent reply	other threads:[~2021-04-16  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  8:34 [PATCH 0/5] Another small set of cleanups for floppy driver Denis Efremov
2021-04-16  8:34 ` [PATCH 1/5] floppy: cleanups: remove trailing whitespaces Denis Efremov
2021-04-16  8:34 ` [PATCH 2/5] floppy: cleanups: use ST0 as reply_buffer index 0 Denis Efremov
2021-04-16  8:34 ` Denis Efremov [this message]
2021-04-16  8:34 ` [PATCH 4/5] floppy: cleanups: use memcpy() to copy reply_buffer Denis Efremov
2021-04-16  8:34 ` [PATCH 5/5] floppy: cleanups: remove FLOPPY_SILENT_DCL_CLEAR undef Denis Efremov
2021-04-16 12:05 ` [PATCH 0/5] Another small set of cleanups for floppy driver Jens Axboe

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=20210416083449.72700-4-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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 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.