lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 30 Dec 2012 22:42:51 +0100 (CET)
From:	Jesper Juhl <>
cc:	Eric Dumazet <>,
	Al Viro <>,
	Dan Carpenter <>,
	Jens Axboe <>
Subject: [PATCH] relay: use sizeof(size_t), not sizeof(size_t *) in

A number of size_t's is what we want to allocate memory for, not a
number of size_t pointers (at least as far as I can tell).
Now, depending on platform, sizeof(size_t *) may be >= sizeof(size_t)
so things actually work, but that's not really a portable assumption,
so let's use the value we actually mean.

Signed-off-by: Jesper Juhl <>
 kernel/relay.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index e8cd202..806931b 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -166,13 +166,13 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan)
 	struct rchan_buf *buf;
-	if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
+	if (chan->n_subbufs > UINT_MAX / sizeof(size_t))
 		return NULL;
 	buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
 	if (!buf)
 		return NULL;
-	buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL);
+	buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t), GFP_KERNEL);
 	if (!buf->padding)
 		goto free_buf;

Jesper Juhl <>
Don't top-post
Plain text mails only, please.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists