lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4ad706519917d493a0af32ea2da8565227cc74a.camel@perches.com>
Date:   Thu, 10 Sep 2020 21:19:35 -0700
From:   Joe Perches <joe@...ches.com>
To:     Robin Murphy <robin.murphy@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        Jiri Kosina <trivial@...nel.org>
Cc:     linux-wireless@...r.kernel.org, linux-fbdev@...r.kernel.org,
        oss-drivers@...ronome.com, nouveau@...ts.freedesktop.org,
        alsa-devel <alsa-devel@...a-project.org>,
        dri-devel@...ts.freedesktop.org, linux-ide@...r.kernel.org,
        dm-devel@...hat.com, linux-mtd@...ts.infradead.org,
        linux-i2c@...r.kernel.org, sparclinux@...r.kernel.org,
        kvmarm@...ts.cs.columbia.edu, linux-rtc@...r.kernel.org,
        linux-s390@...r.kernel.org, linux-scsi@...r.kernel.org,
        dccp@...r.kernel.org, linux-rdma@...r.kernel.org,
        linux-atm-general@...ts.sourceforge.net,
        linux-afs@...ts.infradead.org, coreteam@...filter.org,
        intel-wired-lan@...ts.osuosl.org, linux-serial@...r.kernel.org,
        linux-input@...r.kernel.org, linux-mmc@...r.kernel.org,
        Kees Cook <kees.cook@...onical.com>,
        linux-media@...r.kernel.org, linux-pm@...r.kernel.org,
        intel-gfx@...ts.freedesktop.org, linux-sctp@...r.kernel.org,
        linux-mediatek@...ts.infradead.org, linux-nvme@...ts.infradead.org,
        storagedev@...rochip.com, ceph-devel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-nfs@...r.kernel.org,
        linux-parisc@...r.kernel.org, netdev@...r.kernel.org,
        linux-usb@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-mips@...r.kernel.org, iommu@...ts.linux-foundation.org,
        netfilter-devel@...r.kernel.org, linux-crypto@...r.kernel.org,
        bpf@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        Will Deacon <will@...nel.org>
Subject: Re: [trivial PATCH] treewide: Convert switch/case fallthrough; to
 break;

On Thu, 2020-09-10 at 15:21 +0100, Robin Murphy wrote:
> On 2020-09-09 21:06, Joe Perches wrote:
> > fallthrough to a separate case/default label break; isn't very readable.
> > 
> > Convert pseudo-keyword fallthrough; statements to a simple break; when
> > the next label is case or default and the only statement in the next
> > label block is break;
> > 
> > Found using:
> > 
> > $ grep-2.5.4 -rP --include=*.[ch] -n "fallthrough;(\s*(case\s+\w+|default)\s*:\s*){1,7}break;" *
> > 
> > Miscellanea:
> > 
> > o Move or coalesce a couple label blocks above a default: block.
> > 
> > Signed-off-by: Joe Perches <joe@...ches.com>
> > ---
> > 
> > Compiled allyesconfig x86-64 only.
> > A few files for other arches were not compiled.
> > 
> 
> [...]
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > index c192544e874b..743db1abec40 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > @@ -3777,7 +3777,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> >   	switch (FIELD_GET(IDR0_TTF, reg)) {
> >   	case IDR0_TTF_AARCH32_64:
> >   		smmu->ias = 40;
> > -		fallthrough;
> > +		break;
> >   	case IDR0_TTF_AARCH64:
> >   		break;
> >   	default:
> 
> I have to say I don't really agree with the readability argument for 
> this one - a fallthrough is semantically correct here, since the first 
> case is a superset of the second. It just happens that anything we would 
> do for the common subset is implicitly assumed (there are other 
> potential cases we simply haven't added support for at the moment), thus 
> the second case is currently empty.
> This change actively obfuscates that distinction.

Then perhaps comments should be added to usefully
describe the mechanisms.

	case IDR0_TTF_AARCH32_64:
		smmu->ias = 40;
		fallthrough;	/* and still do the 64 bit processing */
	case IDR0_TTF_AARCH64:
		/* Nothing specific yet */
		break;

> Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ