mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Clay Haapala <chaapala@cisco.com>
To: Meelis Roos <mroos@linux.ee>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64)
Date: Thu, 06 May 2004 14:40:32 -0500	[thread overview]
Message-ID: <yqujr7tx1gzz.fsf@chaapala-lnx2.cisco.com> (raw)
In-Reply-To: <Pine.GSO.4.44.0405061921290.21792-100000@math.ut.ee> (Meelis Roos's message of "Thu, 6 May 2004 20:38:52 +0300 (EEST)")

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;
 }

  reply	other threads:[~2004-05-06 19:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-06 17:38 CRC32c warning on sparc64 Meelis Roos
2004-05-06 19:40 ` Clay Haapala [this message]
2004-05-07 22:01   ` [PATCH] crypto/crc32c.c (was Re: CRC32c warning on sparc64) David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yqujr7tx1gzz.fsf@chaapala-lnx2.cisco.com \
    --to=chaapala@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroos@linux.ee \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®