Skip to contentSkip to conversation

splice: fix unexpected size truncation

PATCH New Xiao Guangrong 1 participant 1 message Jan 13, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 splice: fix unexpected size truncation

@splice_desc.total_len is 32 bit(unsigned int) which is used to store the size passed from userspace which is 64 bit(size_t) so that the size is unexpectedly truncated

That causes vmsplice can not work if the size passed from userspace is >= 4G, for example, we noticed in vmsplice, splice-reader does not do anything and splice-writer is waiting for available buffer forever if the size is 4G

Fix it by extending @splice_desc.total_len to 64 bits as well

---
 include/linux/splice.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/splice.h +2 -1
index 74575cb..1e85396 100644
@@ -24,7 +24,8 @@
  * Passed to the actors
  */
 struct splice_desc {
-	unsigned int len, total_len;	/* current and remaining length */
+	size_t total_len;		/* remaining length */
+	unsigned int len;		/* current length */
 	unsigned int flags;		/* splice flags */
 	/*
 	 * actor() private data
Signature · 1 line
1.8.1.4