mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* CRC32c warning on sparc64
@ 2004-05-06 17:38 Meelis Roos
  2004-05-06 19:40 ` [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64) Clay Haapala
  0 siblings, 1 reply; 3+ messages in thread
From: Meelis Roos @ 2004-05-06 17:38 UTC (permalink / raw)
  To: Clay Haapala, Linux Kernel list

This is 2.6.6-rc3+BK as of today on a sparc64 (gcc 3.3.3 on Debian):

  CC [M]  crypto/crc32c.o
crypto/crc32c.c:89: warning: initialization from incompatible pointer type

This is because chksum_update uses size_t (64-bit unsigned long on
sparc64) length argument but dia_update seems to want unsigned int as
the type of length.

What is the right fix - change the length in chksum_update() and
crc32c() to unsigned int?

-- 
Meelis Roos (mroos@linux.ee)





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

* [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64)
  2004-05-06 17:38 CRC32c warning on sparc64 Meelis Roos
@ 2004-05-06 19:40 ` Clay Haapala
  2004-05-07 22:01   ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Clay Haapala @ 2004-05-06 19:40 UTC (permalink / raw)
  To: Meelis Roos; +Cc: Linux Kernel list

On Thu, 6 May 2004, Meelis Roos uttered the following:
> This is 2.6.6-rc3+BK as of today on a sparc64 (gcc 3.3.3 on Debian):
> 
>   CC [M] crypto/crc32c.o crypto/crc32c.c:89: warning: initialization
>   from incompatible pointer type
> 
> This is because chksum_update uses size_t (64-bit unsigned long on
> sparc64) length argument but dia_update seems to want unsigned int
> as the type of length.
> 
> What is the right fix - change the length in chksum_update() and
> crc32c() to unsigned int?

Well, it's my opinion that using "size_t" is correct usage of type in
this case.  So here's my thinking:

* we leave lib/crc32c() as it is with size_t, as it is meant to be
derived from crc32() and that uses size_t.

* crypto/crc32c is a wrapper for lib/crc32c.  The interface it
presents to the rest of the crypto routines should agree.  My bad.
So, let us let it translate with a cast, as in the patch below.
-- 
Clay Haapala (chaapala@cisco.com) Cisco Systems SRBU +1 763-398-1056
   6450 Wedgwood Rd, Suite 130 Maple Grove MN 55311 PGP: C89240AD
  "Oh, *that* Physics Prize.  Well, I just substituted 'stupidity' for
      'dark matter' in the equations, and it all came together."

--- linux-2.6.6-rc3-bk.orig/crypto/crc32c.c	2004-05-06 14:11:54.000000000 -0500
+++ linux-2.6.6-rc3-bk/crypto/crc32c.c	2004-05-06 14:12:56.000000000 -0500
@@ -56,12 +56,12 @@
 	return 0;
 }
 
-static void chksum_update(void *ctx, const u8 *data, size_t length)
+static void chksum_update(void *ctx, const u8 *data, unsigned int length)
 {
 	struct chksum_ctx *mctx = ctx;
 	u32 mcrc;
 
-	mcrc = crc32c(mctx->crc, data, length);
+	mcrc = crc32c(mctx->crc, data, (size_t)length);
 
 	mctx->crc = mcrc;
 }

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

* Re: [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64)
  2004-05-06 19:40 ` [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64) Clay Haapala
@ 2004-05-07 22:01   ` David S. Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2004-05-07 22:01 UTC (permalink / raw)
  To: Clay Haapala; +Cc: mroos, linux-kernel

On Thu, 06 May 2004 14:40:32 -0500
Clay Haapala <chaapala@cisco.com> wrote:

> Well, it's my opinion that using "size_t" is correct usage of type in
> this case.  So here's my thinking:
> 
> * we leave lib/crc32c() as it is with size_t, as it is meant to be
> derived from crc32() and that uses size_t.
> 
> * crypto/crc32c is a wrapper for lib/crc32c.  The interface it
> presents to the rest of the crypto routines should agree.  My bad.
> So, let us let it translate with a cast, as in the patch below.

This works for me, patch applied.

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

end of thread, other threads:[~2004-05-07 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-06 17:38 CRC32c warning on sparc64 Meelis Roos
2004-05-06 19:40 ` [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64) Clay Haapala
2004-05-07 22:01   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome