Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3585421imc; Thu, 14 Mar 2019 00:02:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ8HOvos2dPzEaWPHii3PuEi+xX9SmHlAfSeeXe1m2lY/9sayQuVpyv2Lj9VBbTjdrGgPC X-Received: by 2002:a17:902:2888:: with SMTP id f8mr50299775plb.244.1552546939813; Thu, 14 Mar 2019 00:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552546939; cv=none; d=google.com; s=arc-20160816; b=hQcxXiLzDCGuJVEL/J39MG1ttvZqauDsMp1dcR7twwVmxYNe7/yKuA5rXkRUHaC/XT WUdJ1aosD4C+5kGxySbSV4cLSVnH9gGQkXSQ4Qk6BtWJzhJGwYRfd3Hsmxr4VMHT7CUP /xh29iHoSTYUKu8zeC/Lu93b9LXIhEV3a2r1PQzx+jEMb0MMyoB7a9xmw/41UeqvUM+L ivkVv+1q4z4iVhbIFvcst+f+QrJYVBp8RVnQUBrHjORTCeQiYGIXRoJijPiD+2jKlZ+q hLGjAUhW5ItPKPh4nNY8FlbwMtCBJgaJDMH0znyIeJzabFfpbAB3/QMLrhyUjSVlpvmf rMfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=57xfuzV3fZoCjDFohT+/414TkXpDmxOBVVt9KP1pE5g=; b=b9gb1/cR5EN5YUJPP2wqnWeczB74C7KJYO8F+9fDxBAZcaG78x9e1x02SlERLxaftE gqgNXxnD4LtF8bPDOwIQXdxQFiOF45SMD3IDPstSLJjzVR1OrB9H48ZThLC7CMapy3Ko Z/s/vcR2+oVMJYzeS87yJit/LuyeGdthplHddNVJInUz7yjk7syB25OslzTXs99Pwr/i NNi4Gb2fAOp9/a9tNC6P7cm2SyQGfPpbyyG5uRG2spytssMGb0kKDfcGtwGi0Vo1Ov70 6I5PJryhWYF8Fz2I+Swti81h5dlWbq053XzDMCZEwYxT9rvqRGi4MX1ySd7DvXBTiw5c IkaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=WL9Hd2LL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si12609795plt.394.2019.03.14.00.02.04; Thu, 14 Mar 2019 00:02:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=WL9Hd2LL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726805AbfCNHBV (ORCPT + 99 others); Thu, 14 Mar 2019 03:01:21 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:56301 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbfCNHBV (ORCPT ); Thu, 14 Mar 2019 03:01:21 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id c2df480a for ; Thu, 14 Mar 2019 06:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=mime-version :references:in-reply-to:from:date:message-id:subject:to:cc :content-type; s=mail; bh=1ntL2n5GEiCS0SNcUaaDGUqhM58=; b=WL9Hd2 LLZX6fdFg2e8v99R7CdhXC7VHevY3VoKgpO412t/bLZJxTApq0j76BfqBI/RAqJ4 NoQ9RDXTy1AahPZHwiYX/PvgiGai6pDPhWkdqJ5yEqkyXXLyIZkbBpQHz6VAO24h 4FvJSFSwmRkPHGN0GP02ytlzmywVWvTYf8zoU9Zr+BsUGSrQddbjTYx/IF9AqleW BT5k1AbhJOrSNPd++Z4Ns8togn1YHdIiQqc+h+w0wZiKQIF/gyc7nWIrT12rDFsP KArjjRxx2DQLDnmYnJyEtudfRPULCuT/br7fkTNnaZREHSvnvCzp6gAftXEMjCHT JxTQZqjjLmsRHj/w== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id ea4fbd6a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 14 Mar 2019 06:40:37 +0000 (UTC) Received: by mail-ot1-f46.google.com with SMTP id c18so4137666otl.13 for ; Thu, 14 Mar 2019 00:01:19 -0700 (PDT) X-Gm-Message-State: APjAAAUGgBGgXzXSzQcz3nKPXbvdkWEj+V2FWwwOhEyeQi0taJeIo5uz v3kACq5yBhQS3tJLQyT5kN4EjsGQxSVHgjHRqLE= X-Received: by 2002:a9d:7645:: with SMTP id o5mr31858423otl.225.1552546878335; Thu, 14 Mar 2019 00:01:18 -0700 (PDT) MIME-Version: 1.0 References: <20190114201911.13725-1-malat@debian.org> <20190313211230.17527-1-malat@debian.org> In-Reply-To: <20190313211230.17527-1-malat@debian.org> From: "Jason A. Donenfeld" Date: Thu, 14 Mar 2019 01:01:07 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] lib/siphash.c: annotate implicit fall throughs To: Mathieu Malaterre Cc: "Gustavo A. R. Silva" , LKML , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, Thanks for getting this v3 into shape. On Wed, Mar 13, 2019 at 3:12 PM Mathieu Malaterre wrote: > There is a plan to build the kernel with -Wimplicit-fallthrough and > these places in the code produced warnings (W=1). Fix them up. > > This commit remove the following warnings: > > lib/siphash.c:71:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:72:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:73:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:75:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:108:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:109:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:110:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:112:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:434:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > lib/siphash.c:462:12: warning: this statement may fall through [-Wimplicit-fallthrough=] > > Move the break statement onto the next line to match the fall-through > comment pattern. Also move the trailing statement onto the next line to > pass checkpatch verification. > > Acked-by: "Gustavo A. R. Silva" > Signed-off-by: Mathieu Malaterre > --- > v3: move break statements onto next line and please checkpatch > v2: some cases were missed in v1, update missing ones > > lib/siphash.c | 76 +++++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 56 insertions(+), 20 deletions(-) > > diff --git a/lib/siphash.c b/lib/siphash.c > index 3ae58b4edad6..f459e0f4a14e 100644 > --- a/lib/siphash.c > +++ b/lib/siphash.c > @@ -68,13 +68,26 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key) > bytemask_from_count(left))); > #else > switch (left) { > - case 7: b |= ((u64)end[6]) << 48; > - case 6: b |= ((u64)end[5]) << 40; > - case 5: b |= ((u64)end[4]) << 32; > - case 4: b |= le32_to_cpup(data); break; > - case 3: b |= ((u64)end[2]) << 16; > - case 2: b |= le16_to_cpup(data); break; > - case 1: b |= end[0]; > + case 7: > + b |= ((u64)end[6]) << 48; > + /* fall through */ > + case 6: > + b |= ((u64)end[5]) << 40; > + /* fall through */ > + case 5: > + b |= ((u64)end[4]) << 32; > + /* fall through */ > + case 4: > + b |= le32_to_cpup(data); > + break; > + case 3: > + b |= ((u64)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= le16_to_cpup(data); > + break; > + case 1: > + b |= end[0]; > } > #endif > POSTAMBLE > @@ -101,13 +114,26 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key) > bytemask_from_count(left))); > #else > switch (left) { > - case 7: b |= ((u64)end[6]) << 48; > - case 6: b |= ((u64)end[5]) << 40; > - case 5: b |= ((u64)end[4]) << 32; > - case 4: b |= get_unaligned_le32(end); break; > - case 3: b |= ((u64)end[2]) << 16; > - case 2: b |= get_unaligned_le16(end); break; > - case 1: b |= end[0]; > + case 7: > + b |= ((u64)end[6]) << 48; > + /* fall through */ > + case 6: > + b |= ((u64)end[5]) << 40; > + /* fall through */ > + case 5: > + b |= ((u64)end[4]) << 32; > + /* fall through */ > + case 4: > + b |= get_unaligned_le32(end); > + break; > + case 3: > + b |= ((u64)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= get_unaligned_le16(end); > + break; > + case 1: > + b |= end[0]; > } > #endif > POSTAMBLE > @@ -431,9 +457,14 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key) > v0 ^= m; > } > switch (left) { > - case 3: b |= ((u32)end[2]) << 16; > - case 2: b |= le16_to_cpup(data); break; > - case 1: b |= end[0]; > + case 3: > + b |= ((u32)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= le16_to_cpup(data); > + break; > + case 1: > + b |= end[0]; > } > HPOSTAMBLE > } > @@ -454,9 +485,14 @@ u32 __hsiphash_unaligned(const void *data, size_t len, > v0 ^= m; > } > switch (left) { > - case 3: b |= ((u32)end[2]) << 16; > - case 2: b |= get_unaligned_le16(end); break; > - case 1: b |= end[0]; > + case 3: > + b |= ((u32)end[2]) << 16; > + /* fall through */ > + case 2: > + b |= get_unaligned_le16(end); > + break; > + case 1: > + b |= end[0]; > } > HPOSTAMBLE > } > -- > 2.20.1 Reviewed-by: Jason A. Donenfeld Greg - would you take this through your tree? Jason