projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8958fd4
)
Convert virtio_console to struct_size
author
Matthew Wilcox
<mawilcox@microsoft.com>
Thu, 7 Jun 2018 14:57:15 +0000
(07:57 -0700)
committer
Kees Cook
<keescook@chromium.org>
Tue, 12 Jun 2018 23:19:22 +0000
(16:19 -0700)
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
drivers/char/virtio_console.c
patch
|
blob
|
history
diff --git
a/drivers/char/virtio_console.c
b/drivers/char/virtio_console.c
index 21085515814f23f09e6fbea4cb49d4d3d99d86c7..4bf7c06c2343e6e09d4fba3bb40254eb65072716 100644
(file)
--- a/
drivers/char/virtio_console.c
+++ b/
drivers/char/virtio_console.c
@@
-433,8
+433,7
@@
static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size
* Allocate buffer and the sg list. The sg list array is allocated
* directly after the port_buffer struct.
*/
- buf = kmalloc(sizeof(*buf) + sizeof(struct scatterlist) * pages,
- GFP_KERNEL);
+ buf = kmalloc(struct_size(buf, sg, pages), GFP_KERNEL);
if (!buf)
goto fail;