lists.openwall.net   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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 18 May 2015 09:33:10 -0600
From:	Louis Langholtz <lou_langholtz@...com>
To:	linux-kernel@...r.kernel.org
Cc:	Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH] include/linux: avoid narrowing length parameter values

memcpy_from_msg() and memcpy_to_msg() functions previously called
memcpy_fromiovec() and memcpy_toiovec() functions respectively. The
memcpy_fromiovec() and memcpy_toiovec() functions took a length parameter
of type int. memcpy_from_msg() and memcpy_to_msg() now call
copy_from_iter() and copy_to_iter() functions respectively which take a length
parameter of type size_t. Most code calling the memcpy_from_msg() and
memcpy_to_msg() functions currently pass a length value of type size_t.
This patch updates the memcpy_from_msg() and memcpy_to_msg() functions
concordantly to take the length parameter of type size_t. This also avoids a potential
for data narrowing.

Signed-off-by: Louis Langholtz <lou_langholtz@...com>
--

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 45e0aa6..ee590fb 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2708,12 +2708,12 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len);
 int skb_vlan_pop(struct sk_buff *skb);
 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
 
-static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
+static inline int memcpy_from_msg(void *data, struct msghdr *msg, size_t len)
 {
        return copy_from_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
 }
 
-static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
+static inline int memcpy_to_msg(struct msghdr *msg, void *data, size_t len)
 {
        return copy_to_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ