[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative
From: |
Marin Ramesa |
Subject: |
[PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative |
Date: |
Mon, 9 Dec 2013 23:57:39 +0100 |
Check if amt is negative. If it is negative the call to memcpy()
will fail. In that case return FALSE.
* device/kmsg.c (kmsg_read_done): Check if amt is negative.
---
device/kmsg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/device/kmsg.c b/device/kmsg.c
index f6a21da..25fa91a 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -169,7 +169,8 @@ kmsg_read_done (io_req_t ior)
if (len < 0)
len += KMSGBUFSIZE;
- amt = ior->io_count;
+ if ((amt = ior->io_count) < 0)
+ return FALSE;
if (amt > len)
amt = len;
--
1.8.1.4
- Re: [PATCH 16/29] device/dev_pager.c (device_pager_data_request_done): check if io_residual is larger or equal to zero and cast it to size_t, (continued)
- [PATCH 17/29] device/dev_pager.c (device_pager_data_request_done): remove unnecessary cast, Marin Ramesa, 2013/12/09
- [PATCH 18/29] device/dev_pager.c: remove forward declaration, Marin Ramesa, 2013/12/09
- [PATCH 19/29] device/dev_pager.c: remove forward declarations, Marin Ramesa, 2013/12/09
- [PATCH 20/29] device/ds_routines.c: remove forward declaration, Marin Ramesa, 2013/12/09
- [PATCH 21/29] device/ds_routines.c (device_write_get): check if io_count is larger or equal to zero and cast it to size_t, Marin Ramesa, 2013/12/09
- [PATCH 22/29] device/kmsg.c (kmsgread): check if io_count is larger or equal to zero and cast it to vm_size_t, Marin Ramesa, 2013/12/09
- [PATCH 23/29] device/kmsg.c (kmsgread, kmsg_read_done): cast arguments to memcpy(), Marin Ramesa, 2013/12/09
- [PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative,
Marin Ramesa <=
- [PATCH 25/29] device/net_io.c: remove forward declarations, Marin Ramesa, 2013/12/09
- [PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is negative, Marin Ramesa, 2013/12/09
- [PATCH 27/29] device/net_io.c (net_getstat): cast arguments to memcpy(), Marin Ramesa, 2013/12/09
- [PATCH 28/29] device/net_io.c (net_getstat): cast arguments to memset(), Marin Ramesa, 2013/12/09
- [PATCH 29/29] device/subrs.c: use io_req_t instead of struct buf, Marin Ramesa, 2013/12/09