[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a539d85-ff17-296c-75be-913731c2febc@users.sourceforge.net>
Date: Wed, 18 Jan 2017 23:00:08 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: user-mode-linux-devel@...ts.sourceforge.net,
user-mode-linux-user@...ts.sourceforge.net,
Anton Ivanov <aivanov@...-begemot.co.uk>,
Dan Williams <dan.j.williams@...el.com>,
Hannes Reinecke <hare@...e.com>, Jeff Dike <jdike@...toit.com>,
Jens Axboe <axboe@...com>, Richard Weinberger <richard@....at>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 5/5] um: ubd: Improve size determinations in do_ubd_request()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 18 Jan 2017 22:38:04 +0100
Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/um/drivers/ubd_kern.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 6d686f735538..50327d5a9a01 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1386,8 +1386,7 @@ static void do_ubd_request(struct request_queue *q)
req = dev->request;
if (req_op(req) == REQ_OP_FLUSH) {
- io_req = kmalloc(sizeof(struct io_thread_req),
- GFP_ATOMIC);
+ io_req = kmalloc(sizeof(*io_req), GFP_ATOMIC);
if (io_req == NULL) {
if (list_empty(&dev->restart))
list_add(&dev->restart, &restart);
@@ -1401,8 +1400,7 @@ static void do_ubd_request(struct request_queue *q)
while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg];
- io_req = kmalloc(sizeof(struct io_thread_req),
- GFP_ATOMIC);
+ io_req = kmalloc(sizeof(*io_req), GFP_ATOMIC);
if(io_req == NULL){
if(list_empty(&dev->restart))
list_add(&dev->restart, &restart);
--
2.11.0
Powered by blists - more mailing lists