diff options
author | Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru> | 2022-11-29 09:23:38 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 11:30:08 +0100 |
commit | 52bcac458bd468e5b9e875fd56658c449f31c4c0 (patch) | |
tree | 058ebff96955417ebe62277b8884e04cc7067ad0 /kernel | |
parent | dd574b92df5bbd32a9de659a1b006fb126239c11 (diff) | |
download | linux-stable-52bcac458bd468e5b9e875fd56658c449f31c4c0.tar.gz linux-stable-52bcac458bd468e5b9e875fd56658c449f31c4c0.tar.bz2 linux-stable-52bcac458bd468e5b9e875fd56658c449f31c4c0.zip |
relay: fix type mismatch when allocating memory in relay_create_buf()
[ Upstream commit 4d8586e04602fe42f0a782d2005956f8b6302678 ]
The 'padding' field of the 'rchan_buf' structure is an array of 'size_t'
elements, but the memory is allocated for an array of 'size_t *' elements.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Link: https://lkml.kernel.org/r/20221129092002.3538384-1-Ilia.Gavrilov@infotecs.ru
Fixes: b86ff981a825 ("[PATCH] relay: migrate from relayfs to a generic relay API")
Signed-off-by: Ilia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: wuchi <wuchi.zero@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/relay.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/relay.c b/kernel/relay.c index 735cb208f023..b7aa7df43955 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -163,13 +163,13 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan) { struct rchan_buf *buf; - if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *)) + if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t)) return NULL; buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL); if (!buf) return NULL; - buf->padding = kmalloc_array(chan->n_subbufs, sizeof(size_t *), + buf->padding = kmalloc_array(chan->n_subbufs, sizeof(size_t), GFP_KERNEL); if (!buf->padding) goto free_buf; |