From patchwork Sat Jan 7 05:51:21 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: 134766 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 552A4B6F71 for ; Sat, 7 Jan 2012 16:56:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933227Ab2AGFzd (ORCPT ); Sat, 7 Jan 2012 00:55:33 -0500 Received: from e2.ny.us.ibm.com ([32.97.182.142]:46908 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751995Ab2AGFv3 (ORCPT ); Sat, 7 Jan 2012 00:51:29 -0500 Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Jan 2012 00:51:28 -0500 Received: from d01relay02.pok.ibm.com (9.56.227.234) by e2.ny.us.ibm.com (192.168.1.102) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 7 Jan 2012 00:51:26 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q075pO9W483346; Sat, 7 Jan 2012 00:51:25 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q075pNEf002350; Sat, 7 Jan 2012 03:51:24 -0200 Received: from elm3c44.beaverton.ibm.com (elm3c44.beaverton.ibm.com [9.47.69.44]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q075pLo6002304; Sat, 7 Jan 2012 03:51:22 -0200 Subject: [PATCH 06/14] 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: Fri, 06 Jan 2012 21:51:21 -0800 Message-ID: <20120107055121.31315.48442.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20120107055042.31315.63119.stgit@elm3c44.beaverton.ibm.com> References: <20120107055042.31315.63119.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 x-cbid: 12010705-5112-0000-0000-000003CDDEBF 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 2a87ea2..ff6bb9a 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; }