From patchwork Wed Jan 18 22:28:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 136714 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 62BE1B6EE7 for ; Thu, 19 Jan 2012 09:31:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751653Ab2ARW3a (ORCPT ); Wed, 18 Jan 2012 17:29:30 -0500 Received: from e37.co.us.ibm.com ([32.97.110.158]:58704 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754237Ab2ARW32 (ORCPT ); Wed, 18 Jan 2012 17:29:28 -0500 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jan 2012 15:29:26 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Jan 2012 15:28:12 -0700 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id D0D4E19D8053; Wed, 18 Jan 2012 15:28:09 -0700 (MST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0IMSAmi3575968; Wed, 18 Jan 2012 17:28:10 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0IMS9a6017569; Wed, 18 Jan 2012 17:28:10 -0500 Received: from elm3c44.beaverton.ibm.com (elm3c44.beaverton.ibm.com [9.47.69.44]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0IMS7Nr017149; Wed, 18 Jan 2012 17:28:08 -0500 Subject: [PATCH 05/13] crc32: Fix mixing of endian-specific types To: Andrew Morton , Herbert Xu , "Darrick J. Wong" From: "Darrick J. Wong" Cc: Theodore Tso , Joakim Tjernlund , Bob Pearson , linux-kernel , Andreas Dilger , linux-crypto , linux-fsdevel , Mingming Cao , linux-ext4@vger.kernel.org Date: Wed, 18 Jan 2012 14:28:07 -0800 Message-ID: <20120118222807.4079.77106.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20120118222733.4079.13377.stgit@elm3c44.beaverton.ibm.com> References: <20120118222733.4079.13377.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12011822-7408-0000-0000-000001FD5EBA Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org crc32.c in its original version freely mixed u32, __le32 and __be32 types which caused warnings from sparse with __CHECK_ENDIAN__. This patch fixes these by forcing the types to u32. From: Bob Pearson Signed-off-by: Bob Pearson [djwong@us.ibm.com: Minor changelog tweaks] Signed-off-by: Darrick J. Wong --- lib/crc32.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/crc32.c b/lib/crc32.c index bf03922..7394288 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -28,13 +28,13 @@ #include "crc32defs.h" #if CRC_LE_BITS == 8 -# define tole(x) __constant_cpu_to_le32(x) +# define tole(x) ((__force u32) __constant_cpu_to_le32(x)) #else # define tole(x) (x) #endif #if CRC_BE_BITS == 8 -# define tobe(x) __constant_cpu_to_be32(x) +# define tobe(x) ((__force u32) __constant_cpu_to_be32(x)) #else # define tobe(x) (x) #endif @@ -128,9 +128,9 @@ u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) # elif CRC_LE_BITS == 8 const u32 (*tab)[] = crc32table_le; - crc = __cpu_to_le32(crc); + crc = (__force u32) __cpu_to_le32(crc); crc = crc32_body(crc, p, len, tab); - crc = __le32_to_cpu(crc); + crc = __le32_to_cpu((__force __le32)crc); #endif return crc; } @@ -171,9 +171,9 @@ u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) # elif CRC_BE_BITS == 8 const u32 (*tab)[] = crc32table_be; - crc = __cpu_to_be32(crc); + crc = (__force u32) __cpu_to_be32(crc); crc = crc32_body(crc, p, len, tab); - crc = __be32_to_cpu(crc); + crc = __be32_to_cpu((__force __be32)crc); # endif return crc; }