linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] byteorder: silence warning by use the proper type
@ 2018-01-24 19:07 rodrigosiqueira
  2018-01-24 21:21 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: rodrigosiqueira @ 2018-01-24 19:07 UTC (permalink / raw)
  To: mika.westerberg; +Cc: michael.jamet, kernel-janitors, linux-kernel

This patch fixes the GCC warning:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]
  for (i = 0; i < len; i++)
                ^

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 include/linux/byteorder/generic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 451aaa0786ae..4e297a6376d3 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -173,7 +173,7 @@ static inline void be64_add_cpu(__be64 *var, u64 val)
 
 static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < len; i++)
 		dst[i] = cpu_to_be32(src[i]);
@@ -181,7 +181,7 @@ static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
 
 static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < len; i++)
 		dst[i] = be32_to_cpu(src[i]);
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] byteorder: silence warning by use the proper type
  2018-01-24 19:07 [PATCH] byteorder: silence warning by use the proper type rodrigosiqueira
@ 2018-01-24 21:21 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-01-24 21:21 UTC (permalink / raw)
  To: rodrigosiqueira
  Cc: mika.westerberg, michael.jamet, kernel-janitors, linux-kernel

On Wed, Jan 24, 2018 at 05:07:25PM -0200, rodrigosiqueira wrote:
> This patch fixes the GCC warning:
> 
> warning: comparison between signed and unsigned integer expressions
> [-Wsign-compare]
>   for (i = 0; i < len; i++)
>                 ^

I wish GCC wouldn't generate warnings which are clearly dumb.  :(  This
kind of warning has a over 99% false positive rate in finding real bugs.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-24 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 19:07 [PATCH] byteorder: silence warning by use the proper type rodrigosiqueira
2018-01-24 21:21 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).