* (unknown),
@ 2015-10-23 12:10 ` LABBE Corentin
0 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: acme, al.drozdov, alexander.h.duyck, daniel, davem,
dmitry.tarnyagin, dwmw2, edumazet, eyal.birger, fw, gustavo,
hannes, herbert, jiri, jmorris, johan.hedberg, kaber, kuznet,
marcel, mst, pablo, samuel, tom, viro, willemb, yoshfuji
Cc: linux-bluetooth, linux-crypto, linux-kernel, netdev
Hello
This patch series was begun by my finding that memcpy_[to|from]_msg have
a parameter len which is an int but used as size_t in whole functions.
Without blindly changing the parameter to size_t, I have tried to see if
anywhere in linux source code, someone give a negative argument with
the following (unfinished) coccinnelle patch.
virtual report
@@
type T;
signed T i;
@@
(
memcpy_from_msg
|
memcpy_to_msg
)
(...,
- i)
+ (size_t)i)
With that I found many place where int variable is used to store unsigned values
and which could be set as size_t since there are used againt size_t
and/or given to functions that wait for size_t.
It permit also to found a bug in net/llc/af_llc.c where a size_t variable
stored error codes.
Regards
^ permalink raw reply [flat|nested] 25+ messages in thread
* (no subject)
@ 2015-10-23 12:10 ` LABBE Corentin
0 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: acme, al.drozdov, alexander.h.duyck, daniel, davem,
dmitry.tarnyagin, dwmw2, edumazet, eyal.birger, fw, gustavo,
hannes, herbert, jiri, jmorris, johan.hedberg, kaber, kuznet,
marcel, mst, pablo, samuel, tom, viro, willemb, yoshfuji
Cc: linux-bluetooth, linux-crypto, linux-kernel, netdev
Hello
This patch series was begun by my finding that memcpy_[to|from]_msg have
a parameter len which is an int but used as size_t in whole functions.
Without blindly changing the parameter to size_t, I have tried to see if
anywhere in linux source code, someone give a negative argument with
the following (unfinished) coccinnelle patch.
virtual report
@@
type T;
signed T i;
@@
(
memcpy_from_msg
|
memcpy_to_msg
)
(...,
- i)
+ (size_t)i)
With that I found many place where int variable is used to store unsigned values
and which could be set as size_t since there are used againt size_t
and/or given to functions that wait for size_t.
It permit also to found a bug in net/llc/af_llc.c where a size_t variable
stored error codes.
Regards
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 01/11] net: change len parameter type for memcpy_[to|from]_msg
2015-10-23 12:10 ` LABBE Corentin
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: alexander.h.duyck, davem, edumazet, fw, hannes, jiri, pablo, tom, viro
Cc: LABBE Corentin, linux-kernel
The len parameter is only used with copy_from_iter() who wait for a
size_t and then compared to return type of copy_from_iter() which is
size_t also. So len must be set as size_t
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
include/linux/skbuff.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4398411..109a127 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2827,12 +2827,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;
}
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 02/11] net: llc: fix a setting of error value to size_t
2015-10-23 12:10 ` LABBE Corentin
(?)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: acme, davem; +Cc: LABBE Corentin, linux-kernel, netdev
The variable copied is a size_t, so setting a negative value to it is
invalid.
The patch add an "err" variable for getting the error code.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/llc/af_llc.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 8dab4e5..79b915d 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -719,9 +719,10 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
unsigned long used;
int target; /* Read at least this many bytes */
long timeo;
+ int err = 0;
lock_sock(sk);
- copied = -ENOTCONN;
+ err = -ENOTCONN;
if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))
goto out;
@@ -745,9 +746,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
* and move it down to the bottom of the loop
*/
if (signal_pending(current)) {
- if (copied)
- break;
- copied = timeo ? sock_intr_errno(timeo) : -EAGAIN;
+ if (!copied)
+ err = timeo ? sock_intr_errno(timeo) : -EAGAIN;
break;
}
@@ -775,7 +775,7 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
break;
if (sk->sk_err) {
- copied = sock_error(sk);
+ err = sock_error(sk);
break;
}
if (sk->sk_shutdown & RCV_SHUTDOWN)
@@ -787,13 +787,15 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
* This occurs when user tries to read
* from never connected socket.
*/
- copied = -ENOTCONN;
+ err = -ENOTCONN;
+ copied = 0;
break;
}
break;
}
if (!timeo) {
- copied = -EAGAIN;
+ err = -EAGAIN;
+ copied = 0;
break;
}
}
@@ -823,7 +825,7 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
if (rc) {
/* Exception. Bailout! */
if (!copied)
- copied = -EFAULT;
+ err = -EFAULT;
break;
}
}
@@ -850,6 +852,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
out:
release_sock(sk);
+ if (err)
+ return err;
return copied;
copy_uaddr:
if (uaddr != NULL && skb != NULL) {
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 03/11] net: llc: change copied to size_t in llc_ui_sendmsg
2015-10-23 12:10 ` LABBE Corentin
` (2 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: acme, davem; +Cc: LABBE Corentin, linux-kernel, netdev
The variable copied in llc_ui_sendmsg() cannot be negative and is used
in functions that wait for unsigned value, so set it as size_t (like it
is in llc_ui_recvmsg())
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/llc/af_llc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 79b915d..f435b77 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -891,7 +891,8 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
int noblock = flags & MSG_DONTWAIT;
struct sk_buff *skb;
size_t size = 0;
- int rc = -EINVAL, copied = 0, hdrlen;
+ int rc = -EINVAL, hdrlen;
+ size_t copied = 0;
dprintk("%s: sending from %02X to %02X\n", __func__,
llc->laddr.lsap, llc->daddr.lsap);
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 04/11] net: packet: change vnet_hdr_len from int to size_t
2015-10-23 12:10 ` LABBE Corentin
` (3 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
2015-10-23 13:35 ` Michael S. Tsirkin
-1 siblings, 1 reply; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: al.drozdov, daniel, davem, dwmw2, edumazet, eyal.birger, mst,
viro, willemb
Cc: LABBE Corentin, linux-kernel, netdev
vnet_hdr_len cannot be negative and is use in operation/function that
wait for unsigned value.
This patch set vnet_hdr_len as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/packet/af_packet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index aa4b15c..58a5c8f 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2632,7 +2632,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
int err, reserve = 0;
struct virtio_net_hdr vnet_hdr = { 0 };
int offset = 0;
- int vnet_hdr_len;
+ size_t vnet_hdr_len;
struct packet_sock *po = pkt_sk(sk);
unsigned short gso_type = 0;
int hlen, tlen;
@@ -3106,7 +3106,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
struct sock *sk = sock->sk;
struct sk_buff *skb;
int copied, err;
- int vnet_hdr_len = 0;
+ size_t vnet_hdr_len = 0;
unsigned int origlen = 0;
err = -EINVAL;
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 05/11] net: irda: change chunk from int to size_t
2015-10-23 12:10 ` LABBE Corentin
` (4 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, samuel; +Cc: LABBE Corentin, linux-kernel, netdev
chunk cannot be negative and is use in operation/function that
wait for unsigned value. This patch set it as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/irda/af_irda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index fae6822..180cca2 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1424,7 +1424,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
timeo = sock_rcvtimeo(sk, noblock);
do {
- int chunk;
+ size_t chunk;
struct sk_buff *skb = skb_dequeue(&sk->sk_receive_queue);
if (skb == NULL) {
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 06/11] net: ipv6: set the length parameter of rawv6_send_hdrinc() to size_t
2015-10-23 12:10 ` LABBE Corentin
` (5 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, jmorris, kaber, kuznet, yoshfuji
Cc: LABBE Corentin, linux-kernel, netdev
length is used in operation/function that wait for unsigned value.
Furthermore the only one call of rawv6_send_hdrinc() give a size_t as
length arguments.
So the parameter need to be set as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/ipv6/raw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index fdbada156..5d9404b 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -609,7 +609,7 @@ out:
return err;
}
-static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
+static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, size_t length,
struct flowi6 *fl6, struct dst_entry **dstp,
unsigned int flags)
{
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 07/11] net: caif: change chunk from int to size_t
2015-10-23 12:10 ` LABBE Corentin
` (6 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
-1 siblings, 0 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, dmitry.tarnyagin; +Cc: LABBE Corentin, linux-kernel, netdev
chunk cannot be negative and is use in operation/function that
wait for unsigned value. This patch set it as size_t.
The patch do the same for the size variable.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/caif/caif_socket.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index cc85891..362f6d8 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -370,7 +370,7 @@ static int caif_stream_recvmsg(struct socket *sock, struct msghdr *msg,
timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT);
do {
- int chunk;
+ size_t chunk;
struct sk_buff *skb;
lock_sock(sk);
@@ -595,7 +595,8 @@ static int caif_stream_sendmsg(struct socket *sock, struct msghdr *msg,
{
struct sock *sk = sock->sk;
struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);
- int err, size;
+ int err;
+ size_t size;
struct sk_buff *skb;
int sent = 0;
long timeo;
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() to size_t
2015-10-23 12:10 ` LABBE Corentin
` (7 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
2015-10-23 12:30 ` kbuild test robot
` (3 more replies)
-1 siblings, 4 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, gustavo, johan.hedberg, marcel
Cc: LABBE Corentin, linux-bluetooth, linux-kernel, netdev
len is used in operation/function that wait for unsigned value.
Furthermore the only one call of sco_send_frame give a size_t as argument.
So the parameter need to be set as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/bluetooth/sco.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index f315c8d..1ae4b36 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -268,7 +268,7 @@ done:
return err;
}
-static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
+static int sco_send_frame(struct sock *sk, struct msghdr *msg, size_t len)
{
struct sco_conn *conn = sco_pi(sk)->conn;
struct sk_buff *skb;
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 09/11] net: ipv6: hlen could be set as size_t
2015-10-23 12:10 ` LABBE Corentin
` (8 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
2015-10-23 12:33 ` kbuild test robot
2015-10-23 12:46 ` kbuild test robot
-1 siblings, 2 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, jmorris, kaber, kuznet, yoshfuji
Cc: LABBE Corentin, linux-kernel, netdev
The hlen member of raw6_frag_vec is used in operation/function that
wait for unsigned value. So it need to be set as size_t.
This patch do the same for the hlen variable.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/ipv6/raw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 5d9404b..434e9ad 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -618,7 +618,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, size_t length,
struct sk_buff *skb;
int err;
struct rt6_info *rt = (struct rt6_info *)*dstp;
- int hlen = LL_RESERVED_SPACE(rt->dst.dev);
+ size_t hlen = LL_RESERVED_SPACE(rt->dst.dev);
int tlen = rt->dst.dev->needed_tailroom;
if (length > rt->dst.dev->mtu) {
@@ -674,7 +674,7 @@ error:
struct raw6_frag_vec {
struct msghdr *msg;
- int hlen;
+ size_t hlen;
char c[4];
};
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 10/11] net: ipv4: hlen could be set as size_t
2015-10-23 12:10 ` LABBE Corentin
` (9 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
2015-10-23 12:43 ` kbuild test robot
2015-10-23 13:08 ` David Miller
-1 siblings, 2 replies; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, jmorris, kaber, kuznet, yoshfuji
Cc: LABBE Corentin, linux-kernel, netdev
The hlen member of raw_frag_vec is used in operation/function that wait
for unsigned value. So it need to be set as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
net/ipv4/raw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 561cd4b..a00aaed 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -86,7 +86,7 @@ struct raw_frag_vec {
struct icmphdr icmph;
char c[1];
} hdr;
- int hlen;
+ size_t hlen;
};
static struct raw_hashinfo raw_v4_hashinfo = {
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 11/11] crypto: algif: Change some variable to size_t
2015-10-23 12:10 ` LABBE Corentin
` (10 preceding siblings ...)
(?)
@ 2015-10-23 12:10 ` LABBE Corentin
2015-11-17 14:08 ` Herbert Xu
-1 siblings, 1 reply; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 12:10 UTC (permalink / raw)
To: davem, herbert; +Cc: LABBE Corentin, linux-crypto, linux-kernel
Some variable are set as int but store only positive values.
Furthermore there are used in operation/function that wait for unsigned
value.
This patch set them as size_t.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
crypto/algif_aead.c | 6 +++---
crypto/algif_skcipher.c | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 0aa6fdf..f70bcf8 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -213,7 +213,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
}
while (size) {
- unsigned long len = size;
+ size_t len = size;
struct scatterlist *sg = NULL;
/* use the existing memory in an allocated page */
@@ -247,7 +247,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
/* allocate a new page */
len = min_t(unsigned long, size, aead_sndbuf(sk));
while (len) {
- int plen = 0;
+ size_t plen = 0;
if (sgl->cur >= ALG_MAX_PAGES) {
aead_put_sgl(sk);
@@ -256,7 +256,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
}
sg = sgl->sg + sgl->cur;
- plen = min_t(int, len, PAGE_SIZE);
+ plen = min_t(size_t, len, PAGE_SIZE);
sg_assign_page(sg, alloc_page(GFP_KERNEL));
err = -ENOMEM;
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index af31a0e..bbb1b66 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -40,7 +40,7 @@ struct skcipher_ctx {
struct af_alg_completion completion;
atomic_t inflight;
- unsigned used;
+ size_t used;
unsigned int len;
bool more;
@@ -153,7 +153,7 @@ static int skcipher_alloc_sgl(struct sock *sk)
return 0;
}
-static void skcipher_pull_sgl(struct sock *sk, int used, int put)
+static void skcipher_pull_sgl(struct sock *sk, size_t used, int put)
{
struct alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private;
@@ -167,7 +167,7 @@ static void skcipher_pull_sgl(struct sock *sk, int used, int put)
sg = sgl->sg;
for (i = 0; i < sgl->cur; i++) {
- int plen = min_t(int, used, sg[i].length);
+ size_t plen = min_t(size_t, used, sg[i].length);
if (!sg_page(sg + i))
continue;
@@ -348,7 +348,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
while (size) {
struct scatterlist *sg;
unsigned long len = size;
- int plen;
+ size_t plen;
if (ctx->merge) {
sgl = list_entry(ctx->tsgl.prev,
@@ -390,7 +390,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
sg_unmark_end(sg + sgl->cur);
do {
i = sgl->cur;
- plen = min_t(int, len, PAGE_SIZE);
+ plen = min_t(size_t, len, PAGE_SIZE);
sg_assign_page(sg + i, alloc_page(GFP_KERNEL));
err = -ENOMEM;
--
2.4.10
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() to size_t
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
@ 2015-10-23 12:30 ` kbuild test robot
2015-10-23 12:36 ` kbuild test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:30 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, gustavo, johan.hedberg, marcel,
LABBE Corentin, linux-bluetooth, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 3706 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: sparc64-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:277:0,
from include/linux/kernel.h:13,
from include/linux/list.h:8,
from include/linux/module.h:9,
from net/bluetooth/sco.c:27:
net/bluetooth/sco.c: In function 'sco_send_frame':
include/linux/dynamic_debug.h:64:16: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
static struct _ddebug __aligned(8) \
^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
^
include/linux/printk.h:283:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
include/net/bluetooth/bluetooth.h:129:26: note: in expansion of macro 'pr_debug'
#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)
^
>> net/bluetooth/sco.c:281:2: note: in expansion of macro 'BT_DBG'
BT_DBG("sk %p len %d", sk, len);
^
vim +/BT_DBG +281 net/bluetooth/sco.c
^1da177e Linus Torvalds 2005-04-16 265 done:
09fd0de5 Gustavo Padovan 2011-06-17 266 hci_dev_unlock(hdev);
^1da177e Linus Torvalds 2005-04-16 267 hci_dev_put(hdev);
^1da177e Linus Torvalds 2005-04-16 268 return err;
^1da177e Linus Torvalds 2005-04-16 269 }
^1da177e Linus Torvalds 2005-04-16 270
722dd7cd LABBE Corentin 2015-10-23 271 static int sco_send_frame(struct sock *sk, struct msghdr *msg, size_t len)
^1da177e Linus Torvalds 2005-04-16 272 {
^1da177e Linus Torvalds 2005-04-16 273 struct sco_conn *conn = sco_pi(sk)->conn;
^1da177e Linus Torvalds 2005-04-16 274 struct sk_buff *skb;
088ce088 Mikel Astiz 2012-04-11 275 int err;
^1da177e Linus Torvalds 2005-04-16 276
^1da177e Linus Torvalds 2005-04-16 277 /* Check outgoing MTU */
^1da177e Linus Torvalds 2005-04-16 278 if (len > conn->mtu)
^1da177e Linus Torvalds 2005-04-16 279 return -EINVAL;
^1da177e Linus Torvalds 2005-04-16 280
^1da177e Linus Torvalds 2005-04-16 @281 BT_DBG("sk %p len %d", sk, len);
^1da177e Linus Torvalds 2005-04-16 282
088ce088 Mikel Astiz 2012-04-11 283 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
b9dbdbc1 Gustavo Padovan 2010-05-01 284 if (!skb)
^1da177e Linus Torvalds 2005-04-16 285 return err;
^1da177e Linus Torvalds 2005-04-16 286
6ce8e9ce Al Viro 2014-04-06 287 if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
b9dbdbc1 Gustavo Padovan 2010-05-01 288 kfree_skb(skb);
b9dbdbc1 Gustavo Padovan 2010-05-01 289 return -EFAULT;
:::::: The code at line 281 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 43756 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 09/11] net: ipv6: hlen could be set as size_t
2015-10-23 12:10 ` [PATCH 09/11] net: ipv6: hlen could be set as size_t LABBE Corentin
@ 2015-10-23 12:33 ` kbuild test robot
2015-10-23 12:46 ` kbuild test robot
1 sibling, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:33 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, jmorris, kaber, kuznet, yoshfuji,
LABBE Corentin, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 3242 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
In file included from include/linux/uio.h:12:0,
from include/linux/socket.h:7,
from net/ipv6/raw.c:23:
net/ipv6/raw.c: In function 'raw6_getfrag':
include/linux/kernel.h:722:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_min1 == &_min2); \
^
>> net/ipv6/raw.c:708:14: note: in expansion of macro 'min'
int copy = min(rfv->hlen - offset, len);
^
vim +/min +708 net/ipv6/raw.c
^1da177e Linus Torvalds 2005-04-16 692 break;
6e8f4d48 Masahide NAKAMURA 2006-08-23 693 case IPPROTO_MH:
19e3c66b Al Viro 2014-11-24 694 rfv->hlen = 4;
19e3c66b Al Viro 2014-11-24 695 err = memcpy_from_msg(rfv->c, rfv->msg, rfv->hlen);
19e3c66b Al Viro 2014-11-24 696 if (!err)
19e3c66b Al Viro 2014-11-24 697 fl6->fl6_mh_type = rfv->c[2];
^1da177e Linus Torvalds 2005-04-16 698 }
19e3c66b Al Viro 2014-11-24 699 return err;
^1da177e Linus Torvalds 2005-04-16 700 }
19e3c66b Al Viro 2014-11-24 701
19e3c66b Al Viro 2014-11-24 702 static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
19e3c66b Al Viro 2014-11-24 703 struct sk_buff *skb)
19e3c66b Al Viro 2014-11-24 704 {
19e3c66b Al Viro 2014-11-24 705 struct raw6_frag_vec *rfv = from;
19e3c66b Al Viro 2014-11-24 706
19e3c66b Al Viro 2014-11-24 707 if (offset < rfv->hlen) {
19e3c66b Al Viro 2014-11-24 @708 int copy = min(rfv->hlen - offset, len);
19e3c66b Al Viro 2014-11-24 709
19e3c66b Al Viro 2014-11-24 710 if (skb->ip_summed == CHECKSUM_PARTIAL)
19e3c66b Al Viro 2014-11-24 711 memcpy(to, rfv->c + offset, copy);
19e3c66b Al Viro 2014-11-24 712 else
19e3c66b Al Viro 2014-11-24 713 skb->csum = csum_block_add(
19e3c66b Al Viro 2014-11-24 714 skb->csum,
19e3c66b Al Viro 2014-11-24 715 csum_partial_copy_nocheck(rfv->c + offset,
19e3c66b Al Viro 2014-11-24 716 to, copy, 0),
:::::: The code at line 708 was first introduced by commit
:::::: 19e3c66b52caf20a9a1119dc847b6abae4c03f4f ipv6 equivalent of "ipv4: Avoid reading user iov twice after raw_probe_proto_opt"
:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 42431 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() to size_t
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
2015-10-23 12:30 ` kbuild test robot
@ 2015-10-23 12:36 ` kbuild test robot
2015-10-23 12:40 ` kbuild test robot
2015-10-25 19:54 ` Marcel Holtmann
3 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:36 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, gustavo, johan.hedberg, marcel,
LABBE Corentin, linux-bluetooth, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 2777 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: tile-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All warnings (new ones prefixed by >>):
net/bluetooth/sco.c: In function 'sco_send_frame':
>> net/bluetooth/sco.c:281:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat]
vim +281 net/bluetooth/sco.c
^1da177e Linus Torvalds 2005-04-16 265 done:
09fd0de5 Gustavo Padovan 2011-06-17 266 hci_dev_unlock(hdev);
^1da177e Linus Torvalds 2005-04-16 267 hci_dev_put(hdev);
^1da177e Linus Torvalds 2005-04-16 268 return err;
^1da177e Linus Torvalds 2005-04-16 269 }
^1da177e Linus Torvalds 2005-04-16 270
722dd7cd LABBE Corentin 2015-10-23 271 static int sco_send_frame(struct sock *sk, struct msghdr *msg, size_t len)
^1da177e Linus Torvalds 2005-04-16 272 {
^1da177e Linus Torvalds 2005-04-16 273 struct sco_conn *conn = sco_pi(sk)->conn;
^1da177e Linus Torvalds 2005-04-16 274 struct sk_buff *skb;
088ce088 Mikel Astiz 2012-04-11 275 int err;
^1da177e Linus Torvalds 2005-04-16 276
^1da177e Linus Torvalds 2005-04-16 277 /* Check outgoing MTU */
^1da177e Linus Torvalds 2005-04-16 278 if (len > conn->mtu)
^1da177e Linus Torvalds 2005-04-16 279 return -EINVAL;
^1da177e Linus Torvalds 2005-04-16 280
^1da177e Linus Torvalds 2005-04-16 @281 BT_DBG("sk %p len %d", sk, len);
^1da177e Linus Torvalds 2005-04-16 282
088ce088 Mikel Astiz 2012-04-11 283 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
b9dbdbc1 Gustavo Padovan 2010-05-01 284 if (!skb)
^1da177e Linus Torvalds 2005-04-16 285 return err;
^1da177e Linus Torvalds 2005-04-16 286
6ce8e9ce Al Viro 2014-04-06 287 if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
b9dbdbc1 Gustavo Padovan 2010-05-01 288 kfree_skb(skb);
b9dbdbc1 Gustavo Padovan 2010-05-01 289 return -EFAULT;
:::::: The code at line 281 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 41625 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() to size_t
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
2015-10-23 12:30 ` kbuild test robot
2015-10-23 12:36 ` kbuild test robot
@ 2015-10-23 12:40 ` kbuild test robot
2015-10-25 19:54 ` Marcel Holtmann
3 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:40 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, gustavo, johan.hedberg, marcel,
LABBE Corentin, linux-bluetooth, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 3448 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:13:0,
from include/linux/list.h:8,
from include/linux/module.h:9,
from net/bluetooth/sco.c:27:
net/bluetooth/sco.c: In function 'sco_send_frame':
>> net/bluetooth/sco.c:281:9: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
BT_DBG("sk %p len %d", sk, len);
^
include/linux/printk.h:236:21: note: in definition of macro 'pr_fmt'
#define pr_fmt(fmt) fmt
^
include/linux/printk.h:283:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
include/net/bluetooth/bluetooth.h:129:26: note: in expansion of macro 'pr_debug'
#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)
^
net/bluetooth/sco.c:281:2: note: in expansion of macro 'BT_DBG'
BT_DBG("sk %p len %d", sk, len);
^
vim +281 net/bluetooth/sco.c
^1da177e Linus Torvalds 2005-04-16 265 done:
09fd0de5 Gustavo Padovan 2011-06-17 266 hci_dev_unlock(hdev);
^1da177e Linus Torvalds 2005-04-16 267 hci_dev_put(hdev);
^1da177e Linus Torvalds 2005-04-16 268 return err;
^1da177e Linus Torvalds 2005-04-16 269 }
^1da177e Linus Torvalds 2005-04-16 270
722dd7cd LABBE Corentin 2015-10-23 271 static int sco_send_frame(struct sock *sk, struct msghdr *msg, size_t len)
^1da177e Linus Torvalds 2005-04-16 272 {
^1da177e Linus Torvalds 2005-04-16 273 struct sco_conn *conn = sco_pi(sk)->conn;
^1da177e Linus Torvalds 2005-04-16 274 struct sk_buff *skb;
088ce088 Mikel Astiz 2012-04-11 275 int err;
^1da177e Linus Torvalds 2005-04-16 276
^1da177e Linus Torvalds 2005-04-16 277 /* Check outgoing MTU */
^1da177e Linus Torvalds 2005-04-16 278 if (len > conn->mtu)
^1da177e Linus Torvalds 2005-04-16 279 return -EINVAL;
^1da177e Linus Torvalds 2005-04-16 280
^1da177e Linus Torvalds 2005-04-16 @281 BT_DBG("sk %p len %d", sk, len);
^1da177e Linus Torvalds 2005-04-16 282
088ce088 Mikel Astiz 2012-04-11 283 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
b9dbdbc1 Gustavo Padovan 2010-05-01 284 if (!skb)
^1da177e Linus Torvalds 2005-04-16 285 return err;
^1da177e Linus Torvalds 2005-04-16 286
6ce8e9ce Al Viro 2014-04-06 287 if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
b9dbdbc1 Gustavo Padovan 2010-05-01 288 kfree_skb(skb);
b9dbdbc1 Gustavo Padovan 2010-05-01 289 return -EFAULT;
:::::: The code at line 281 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 50364 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 10/11] net: ipv4: hlen could be set as size_t
2015-10-23 12:10 ` [PATCH 10/11] net: ipv4: " LABBE Corentin
@ 2015-10-23 12:43 ` kbuild test robot
2015-10-23 13:08 ` David Miller
1 sibling, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:43 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, jmorris, kaber, kuznet, yoshfuji,
LABBE Corentin, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 3399 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
In file included from include/asm-generic/bug.h:13:0,
from arch/xtensa/include/generated/asm/bug.h:1,
from include/linux/bug.h:4,
from include/linux/thread_info.h:11,
from arch/xtensa/include/asm/current.h:16,
from net/ipv4/raw.c:43:
net/ipv4/raw.c: In function 'raw_getfrag':
include/linux/kernel.h:722:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_min1 == &_min2); \
^
>> net/ipv4/raw.c:458:14: note: in expansion of macro 'min'
int copy = min(rfv->hlen - offset, len);
^
vim +/min +458 net/ipv4/raw.c
b61e9dcc5 Al Viro 2014-11-24 442 err = memcpy_from_msg(rfv->hdr.c, rfv->msg, rfv->hlen);
32b5913a9 Herbert Xu 2014-11-07 443 if (err)
32b5913a9 Herbert Xu 2014-11-07 444 return err;
^1da177e4 Linus Torvalds 2005-04-16 445
c008ba5bd Herbert Xu 2014-11-07 446 fl4->fl4_icmp_type = rfv->hdr.icmph.type;
c008ba5bd Herbert Xu 2014-11-07 447 fl4->fl4_icmp_code = rfv->hdr.icmph.code;
^1da177e4 Linus Torvalds 2005-04-16 448
a27b58fed Heiko Carstens 2006-10-30 449 return 0;
^1da177e4 Linus Torvalds 2005-04-16 450 }
^1da177e4 Linus Torvalds 2005-04-16 451
c008ba5bd Herbert Xu 2014-11-07 452 static int raw_getfrag(void *from, char *to, int offset, int len, int odd,
c008ba5bd Herbert Xu 2014-11-07 453 struct sk_buff *skb)
c008ba5bd Herbert Xu 2014-11-07 454 {
c008ba5bd Herbert Xu 2014-11-07 455 struct raw_frag_vec *rfv = from;
c008ba5bd Herbert Xu 2014-11-07 456
c008ba5bd Herbert Xu 2014-11-07 457 if (offset < rfv->hlen) {
c008ba5bd Herbert Xu 2014-11-07 @458 int copy = min(rfv->hlen - offset, len);
c008ba5bd Herbert Xu 2014-11-07 459
c008ba5bd Herbert Xu 2014-11-07 460 if (skb->ip_summed == CHECKSUM_PARTIAL)
c008ba5bd Herbert Xu 2014-11-07 461 memcpy(to, rfv->hdr.c + offset, copy);
c008ba5bd Herbert Xu 2014-11-07 462 else
c008ba5bd Herbert Xu 2014-11-07 463 skb->csum = csum_block_add(
c008ba5bd Herbert Xu 2014-11-07 464 skb->csum,
c008ba5bd Herbert Xu 2014-11-07 465 csum_partial_copy_nocheck(rfv->hdr.c + offset,
c008ba5bd Herbert Xu 2014-11-07 466 to, copy, 0),
:::::: The code at line 458 was first introduced by commit
:::::: c008ba5bdc9fa830e1a349b20b0be5a137bdef7a ipv4: Avoid reading user iov twice after raw_probe_proto_opt
:::::: TO: Herbert Xu <herbert@gondor.apana.org.au>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 42431 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 09/11] net: ipv6: hlen could be set as size_t
2015-10-23 12:10 ` [PATCH 09/11] net: ipv6: hlen could be set as size_t LABBE Corentin
2015-10-23 12:33 ` kbuild test robot
@ 2015-10-23 12:46 ` kbuild test robot
1 sibling, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2015-10-23 12:46 UTC (permalink / raw)
To: LABBE Corentin
Cc: kbuild-all, davem, jmorris, kaber, kuznet, yoshfuji,
LABBE Corentin, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 2916 bytes --]
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: tile-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All warnings (new ones prefixed by >>):
net/ipv6/raw.c: In function 'raw6_getfrag':
>> net/ipv6/raw.c:708:14: warning: comparison of distinct pointer types lacks a cast [enabled by default]
vim +708 net/ipv6/raw.c
^1da177e Linus Torvalds 2005-04-16 692 break;
6e8f4d48 Masahide NAKAMURA 2006-08-23 693 case IPPROTO_MH:
19e3c66b Al Viro 2014-11-24 694 rfv->hlen = 4;
19e3c66b Al Viro 2014-11-24 695 err = memcpy_from_msg(rfv->c, rfv->msg, rfv->hlen);
19e3c66b Al Viro 2014-11-24 696 if (!err)
19e3c66b Al Viro 2014-11-24 697 fl6->fl6_mh_type = rfv->c[2];
^1da177e Linus Torvalds 2005-04-16 698 }
19e3c66b Al Viro 2014-11-24 699 return err;
^1da177e Linus Torvalds 2005-04-16 700 }
19e3c66b Al Viro 2014-11-24 701
19e3c66b Al Viro 2014-11-24 702 static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
19e3c66b Al Viro 2014-11-24 703 struct sk_buff *skb)
19e3c66b Al Viro 2014-11-24 704 {
19e3c66b Al Viro 2014-11-24 705 struct raw6_frag_vec *rfv = from;
19e3c66b Al Viro 2014-11-24 706
19e3c66b Al Viro 2014-11-24 707 if (offset < rfv->hlen) {
19e3c66b Al Viro 2014-11-24 @708 int copy = min(rfv->hlen - offset, len);
19e3c66b Al Viro 2014-11-24 709
19e3c66b Al Viro 2014-11-24 710 if (skb->ip_summed == CHECKSUM_PARTIAL)
19e3c66b Al Viro 2014-11-24 711 memcpy(to, rfv->c + offset, copy);
19e3c66b Al Viro 2014-11-24 712 else
19e3c66b Al Viro 2014-11-24 713 skb->csum = csum_block_add(
19e3c66b Al Viro 2014-11-24 714 skb->csum,
19e3c66b Al Viro 2014-11-24 715 csum_partial_copy_nocheck(rfv->c + offset,
19e3c66b Al Viro 2014-11-24 716 to, copy, 0),
:::::: The code at line 708 was first introduced by commit
:::::: 19e3c66b52caf20a9a1119dc847b6abae4c03f4f ipv6 equivalent of "ipv4: Avoid reading user iov twice after raw_probe_proto_opt"
:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 41625 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 10/11] net: ipv4: hlen could be set as size_t
2015-10-23 12:10 ` [PATCH 10/11] net: ipv4: " LABBE Corentin
2015-10-23 12:43 ` kbuild test robot
@ 2015-10-23 13:08 ` David Miller
2015-10-23 13:21 ` LABBE Corentin
1 sibling, 1 reply; 25+ messages in thread
From: David Miller @ 2015-10-23 13:08 UTC (permalink / raw)
To: clabbe.montjoie; +Cc: jmorris, kaber, kuznet, yoshfuji, linux-kernel, netdev
From: LABBE Corentin <clabbe.montjoie@gmail.com>
Date: Fri, 23 Oct 2015 14:10:35 +0200
> The hlen member of raw_frag_vec is used in operation/function that wait
> for unsigned value. So it need to be set as size_t.
>
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
You really need to test your changes.
Particularly on a platform where size_t has a different size than
'int'. That will generate several warnings, as shown by all of the
build warning reports sent by the kbuild test robot in response to
this patch series.
Also, you need to CC: all relevant mailing lists for the entire series
of patches, and also provide a "Subject: [PATCH 0/N] xxx" posting
describing at a high level and in detail what this patch series is
doing, and why.
It should also clearly state what exact tree you expect these patches
to be merged into.
Thanks.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 10/11] net: ipv4: hlen could be set as size_t
2015-10-23 13:08 ` David Miller
@ 2015-10-23 13:21 ` LABBE Corentin
2015-10-23 13:51 ` David Miller
0 siblings, 1 reply; 25+ messages in thread
From: LABBE Corentin @ 2015-10-23 13:21 UTC (permalink / raw)
To: David Miller; +Cc: jmorris, kaber, kuznet, yoshfuji, linux-kernel, netdev
On Fri, Oct 23, 2015 at 06:08:52AM -0700, David Miller wrote:
> From: LABBE Corentin <clabbe.montjoie@gmail.com>
> Date: Fri, 23 Oct 2015 14:10:35 +0200
>
> > The hlen member of raw_frag_vec is used in operation/function that wait
> > for unsigned value. So it need to be set as size_t.
> >
> > Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
>
> You really need to test your changes.
>
> Particularly on a platform where size_t has a different size than
> 'int'. That will generate several warnings, as shown by all of the
> build warning reports sent by the kbuild test robot in response to
> this patch series.
>
> Also, you need to CC: all relevant mailing lists for the entire series
> of patches, and also provide a "Subject: [PATCH 0/N] xxx" posting
> describing at a high level and in detail what this patch series is
> doing, and why.
>
> It should also clearly state what exact tree you expect these patches
> to be merged into.
>
> Thanks.
Hello
I am sorry, I have badly checked my build logs.
I have added all mailing list given by get_maintainer but this was done per patch with --to-cmd/--cc-cmd
Does it is better to put all mailing list globally ?
For the (0/N) mail, I forgot to add a subject on it https://lkml.org/lkml/2015/10/23/219
I will fix all minor finding and resend a proper version.
Thanks
LABBE Corentin
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 04/11] net: packet: change vnet_hdr_len from int to size_t
2015-10-23 12:10 ` [PATCH 04/11] net: packet: change vnet_hdr_len from int to size_t LABBE Corentin
@ 2015-10-23 13:35 ` Michael S. Tsirkin
0 siblings, 0 replies; 25+ messages in thread
From: Michael S. Tsirkin @ 2015-10-23 13:35 UTC (permalink / raw)
To: LABBE Corentin
Cc: al.drozdov, daniel, davem, dwmw2, edumazet, eyal.birger, viro,
willemb, linux-kernel, netdev
On Fri, Oct 23, 2015 at 02:10:29PM +0200, LABBE Corentin wrote:
> vnet_hdr_len cannot be negative and is use in operation/function that
> wait for unsigned value.
> This patch set vnet_hdr_len as size_t.
>
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
These things need to be done carefully.
I'll look at this next week.
> ---
> net/packet/af_packet.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index aa4b15c..58a5c8f 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2632,7 +2632,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
> int err, reserve = 0;
> struct virtio_net_hdr vnet_hdr = { 0 };
> int offset = 0;
> - int vnet_hdr_len;
> + size_t vnet_hdr_len;
> struct packet_sock *po = pkt_sk(sk);
> unsigned short gso_type = 0;
> int hlen, tlen;
> @@ -3106,7 +3106,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> struct sock *sk = sock->sk;
> struct sk_buff *skb;
> int copied, err;
> - int vnet_hdr_len = 0;
> + size_t vnet_hdr_len = 0;
> unsigned int origlen = 0;
>
> err = -EINVAL;
> --
> 2.4.10
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 10/11] net: ipv4: hlen could be set as size_t
2015-10-23 13:21 ` LABBE Corentin
@ 2015-10-23 13:51 ` David Miller
0 siblings, 0 replies; 25+ messages in thread
From: David Miller @ 2015-10-23 13:51 UTC (permalink / raw)
To: clabbe.montjoie; +Cc: jmorris, kaber, kuznet, yoshfuji, linux-kernel, netdev
From: LABBE Corentin <clabbe.montjoie@gmail.com>
Date: Fri, 23 Oct 2015 15:21:00 +0200
> I have added all mailing list given by get_maintainer but this was done per patch with --to-cmd/--cc-cmd
> Does it is better to put all mailing list globally ?
>
> For the (0/N) mail, I forgot to add a subject on it https://lkml.org/lkml/2015/10/23/219
>
> I will fix all minor finding and resend a proper version.
Ask yourself the question: who will apply my patch series and to what tree will
they apply it.
If you cannot answer that question, you probably need to more properly split
up your patches into several patch series, one for each intended maintainer
and their respective tree.
It is impossible to review some subset of a patch series, if the whole series
isn't also available to read for the purposes of context.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() to size_t
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
` (2 preceding siblings ...)
2015-10-23 12:40 ` kbuild test robot
@ 2015-10-25 19:54 ` Marcel Holtmann
3 siblings, 0 replies; 25+ messages in thread
From: Marcel Holtmann @ 2015-10-25 19:54 UTC (permalink / raw)
To: LABBE Corentin
Cc: David S. Miller, Gustavo F. Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel, netdev
Hi Corentin,
> len is used in operation/function that wait for unsigned value.
> Furthermore the only one call of sco_send_frame give a size_t as argument.
> So the parameter need to be set as size_t.
>
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> ---
> net/bluetooth/sco.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I am not taking this patch until you also fix the kbuild test robot reported issue with format print modifier for size_t.
Regards
Marcel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 11/11] crypto: algif: Change some variable to size_t
2015-10-23 12:10 ` [PATCH 11/11] crypto: algif: Change some variable to size_t LABBE Corentin
@ 2015-11-17 14:08 ` Herbert Xu
0 siblings, 0 replies; 25+ messages in thread
From: Herbert Xu @ 2015-11-17 14:08 UTC (permalink / raw)
To: LABBE Corentin; +Cc: davem, linux-crypto, linux-kernel
On Fri, Oct 23, 2015 at 02:10:36PM +0200, LABBE Corentin wrote:
> Some variable are set as int but store only positive values.
> Furthermore there are used in operation/function that wait for unsigned
> value.
> This patch set them as size_t.
>
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2015-11-17 14:08 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 12:10 (unknown), LABBE Corentin
2015-10-23 12:10 ` LABBE Corentin
2015-10-23 12:10 ` [PATCH 01/11] net: change len parameter type for memcpy_[to|from]_msg LABBE Corentin
2015-10-23 12:10 ` [PATCH 02/11] net: llc: fix a setting of error value to size_t LABBE Corentin
2015-10-23 12:10 ` [PATCH 03/11] net: llc: change copied to size_t in llc_ui_sendmsg LABBE Corentin
2015-10-23 12:10 ` [PATCH 04/11] net: packet: change vnet_hdr_len from int to size_t LABBE Corentin
2015-10-23 13:35 ` Michael S. Tsirkin
2015-10-23 12:10 ` [PATCH 05/11] net: irda: change chunk " LABBE Corentin
2015-10-23 12:10 ` [PATCH 06/11] net: ipv6: set the length parameter of rawv6_send_hdrinc() " LABBE Corentin
2015-10-23 12:10 ` [PATCH 07/11] net: caif: change chunk from int " LABBE Corentin
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
2015-10-23 12:30 ` kbuild test robot
2015-10-23 12:36 ` kbuild test robot
2015-10-23 12:40 ` kbuild test robot
2015-10-25 19:54 ` Marcel Holtmann
2015-10-23 12:10 ` [PATCH 09/11] net: ipv6: hlen could be set as size_t LABBE Corentin
2015-10-23 12:33 ` kbuild test robot
2015-10-23 12:46 ` kbuild test robot
2015-10-23 12:10 ` [PATCH 10/11] net: ipv4: " LABBE Corentin
2015-10-23 12:43 ` kbuild test robot
2015-10-23 13:08 ` David Miller
2015-10-23 13:21 ` LABBE Corentin
2015-10-23 13:51 ` David Miller
2015-10-23 12:10 ` [PATCH 11/11] crypto: algif: Change some variable to size_t LABBE Corentin
2015-11-17 14:08 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.