Skip to content

Commit

Permalink
floppy: cleanups: use memset() to zero reply_buffer
Browse files Browse the repository at this point in the history
Use memset() to zero reply buffer in raw_cmd_copyin() instead
of a for loop.

Signed-off-by: Denis Efremov <efremov@linux.com>
Link: https://lore.kernel.org/r/20210416083449.72700-4-efremov@linux.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
evdenis authored and axboe committed Apr 20, 2021
1 parent 67c0716 commit f6df18f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)) {
Expand Down

0 comments on commit f6df18f

Please sign in to comment.