+ relay-fix-bogus-cast-in-subbuf_splice_actor.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     relay: fix bogus cast in subbuf_splice_actor()
has been added to the -mm tree.  Its filename is
     relay-fix-bogus-cast-in-subbuf_splice_actor.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: relay: fix bogus cast in subbuf_splice_actor()
From: Tom Zanussi <zanussi@xxxxxxxxxx>

The current code that sets the read position in subbuf_splice_actor may give
erroneous results if the buffer size isn't a power of 2.  This patch fixes the
problem.

Signed-off-by: Tom Zanussi <zanussi@xxxxxxxxxx>
Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/relay.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN kernel/relay.c~relay-fix-bogus-cast-in-subbuf_splice_actor kernel/relay.c
--- a/kernel/relay.c~relay-fix-bogus-cast-in-subbuf_splice_actor
+++ a/kernel/relay.c
@@ -1074,7 +1074,9 @@ static int subbuf_splice_actor(struct fi
 	unsigned int pidx, poff, total_len, subbuf_pages, ret;
 	struct rchan_buf *rbuf = in->private_data;
 	unsigned int subbuf_size = rbuf->chan->subbuf_size;
-	size_t read_start = ((size_t)*ppos) % rbuf->chan->alloc_size;
+	uint64_t pos = (uint64_t) *ppos;
+	uint32_t alloc_size = (uint32_t) rbuf->chan->alloc_size;
+	size_t read_start = (size_t) do_div(pos, alloc_size);
 	size_t read_subbuf = read_start / subbuf_size;
 	size_t padding = rbuf->padding[read_subbuf];
 	size_t nonpad_end = read_subbuf * subbuf_size + subbuf_size - padding;
_

Patches currently in -mm which might be from zanussi@xxxxxxxxxx are

git-block.patch
relay-fix-subbuf_splice_actor-comment.patch
relay-fix-bogus-cast-in-subbuf_splice_actor.patch
kernel-relayc-make-functions-static.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux