Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3301535imc; Wed, 13 Mar 2019 14:14:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyStJlA8v/HaC3lay4/Dnd9FGcGSLxQ49rKaLnqQXQsuSDMUdnzNYY2RP/MV543hYcq3QWY X-Received: by 2002:a63:4346:: with SMTP id q67mr40914781pga.92.1552511642897; Wed, 13 Mar 2019 14:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552511642; cv=none; d=google.com; s=arc-20160816; b=UyPpUrgK691nSPotThlHTm4O2iJXCmwsXo/Cg1x7BaCp2KIY9UZfN5Vy7GO2C/ryq2 4Wl8+z0niLbmjo6d4ejPAF33VqMb3tcghC9pewuYZZHCT6OMZC2qBS8WO3cxMghCrqgn bVVxjX6L+7HUsbhGr5Ug8K+OhML1bB+1+zPB8RgVk/TQXZ/YjvW1xP7r/DpbLfH3EG4m irsZQ4h1YwoquGfJfF5IIaAN4fel2MVfapx7w8ckS9zZLyOgyFzKaPCabWHjv8BeExZo /hwdT3aIlVNcR+SMjd4NP2CnOqqbH4MRPJ382htZwXpMV03uj2ZH11UyGhFrJtOlBe7I VVNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3yDHN758qs9niJt5sETfy4WdqiHkxw2spT/deZ7Yxs8=; b=l5S/fRQ2uEJGshzipslGKieb9Sa8v6rVrjU5g1xbn3rRXVytj1xDH495KrLZ5e757s xcoj9CnD2gmI+062LruIt1A6eSiWSZ5fsAU6dBlIOeD3PjtSP0e+svS5TfCdWp1Hc9D4 SFxQ27YGu+oMqS1JcDutMkAurwRQGln2/JYHYHGrQf2aippC51etrJbBBA8kjhyftG/m JTOjmO7Jt/giIx+0C2xvA1Db0LWMQDWk5KxXEgmtUWEJhxSDUosfeI6JVvBouR7HOOFk PCiPGPg6wN62/9veBfLtQyiAZ7wYtb//osTlszDKa/EOYno1yZO2tV1vSc77UXPRi2j0 xmkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RUzJQhsy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si10029503pgp.376.2019.03.13.14.13.46; Wed, 13 Mar 2019 14:14:02 -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=fail header.i=@gmail.com header.s=20161025 header.b=RUzJQhsy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbfCMVMz (ORCPT + 99 others); Wed, 13 Mar 2019 17:12:55 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42943 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbfCMVMz (ORCPT ); Wed, 13 Mar 2019 17:12:55 -0400 Received: by mail-wr1-f66.google.com with SMTP id o9so3555529wrv.9 for ; Wed, 13 Mar 2019 14:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3yDHN758qs9niJt5sETfy4WdqiHkxw2spT/deZ7Yxs8=; b=RUzJQhsyGtzldGyQX5GF4WO3g3Jrx/WLKpLjI6U4NoUbmrp02tiuPMTSXbiC2zr4km EOuGLNORWRVhU4aJ8XNounjkkdXXLasE+Tvr9+tr3M2brmGCeOue9E2ZWjLnwuh2DFc/ v+OwsWkUg2pbsnsrcIYDCvVhRoczmeX/WmzYc09d5gzBlWh6JSoZsROLC3PooB448wYT cd8g+wup5wygTvrqTHDl4iAYdF65R1jGZmmtEiGhfp0zn/HEPuPC5SxGxm7GS/6gXol8 DBoe4lopyC7Ae25MWOTvp8zt5GXBLBwPixsF4ptjv88hhWm2VoBwGWyVsgwJ9oOXiL2/ uv7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3yDHN758qs9niJt5sETfy4WdqiHkxw2spT/deZ7Yxs8=; b=FKokb5kE/uEUeXMa35Osgf0516uFuS0MgcFY8n5iDnyC4FPbQLsKFR1S5pRNV4fAt/ 3Mci9zg5nqR9tFgTbBY3iJBt1FuY2I1YqzO7ONy1TnYJkvfdEf6/l+YPTDrGheq+U88L p7CCLMsHL8WiQbs4CSdH+754UzYASY4wUOcX39RBgscDWuVSj7ZkHCqYG0hxVA+MhaCh uCVe0ABX21f2ICiS6T1JqG8EsYHfzBIEkW2HzAo525HUuUSOa1UcQrRemsQuEMYuV1no piKkrsU/3J4LPppBM2PqXsyuHUXMibsCoZx244CXV4QZ6D4232lP4/rUcwTXIXJnYXau Wzmg== X-Gm-Message-State: APjAAAWWvkKLx5PjMR+4/X+QI5Vm4GUKV4UOV+Ot1213iRGWq3TeUIrz R/tvZGOgyvSBsZqSLB+Pcyg= X-Received: by 2002:a5d:6a0c:: with SMTP id m12mr10652660wru.57.1552511572357; Wed, 13 Mar 2019 14:12:52 -0700 (PDT) Received: from macbookpro.malat.net ([2a01:e34:ee1e:860:6f23:82e6:aa2d:bbd1]) by smtp.gmail.com with ESMTPSA id f68sm217960wmg.5.2019.03.13.14.12.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Mar 2019 14:12:51 -0700 (PDT) Received: by macbookpro.malat.net (Postfix, from userid 1000) id 041631140A07; Wed, 13 Mar 2019 22:12:49 +0100 (CET) From: Mathieu Malaterre To: "Jason A. Donenfeld" Cc: Mathieu Malaterre , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: [PATCH v3] lib/siphash.c: annotate implicit fall throughs Date: Wed, 13 Mar 2019 22:12:30 +0100 Message-Id: <20190313211230.17527-1-malat@debian.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114201911.13725-1-malat@debian.org> References: <20190114201911.13725-1-malat@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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