From owner-svn-src-head@freebsd.org Tue Sep 8 12:48:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAE8D337A61; Tue, 8 Sep 2020 12:48:53 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bm4hh2njMz3T84; Tue, 8 Sep 2020 12:48:52 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x841.google.com with SMTP id z2so11701979qtv.12; Tue, 08 Sep 2020 05:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wSsLOe5Lyn7H7ifVAKEYuRl4ZOhT8g45K/m16x4i8eA=; b=bUtuKyrnSLyiNyKqpuXML4x6VriDYRSyNiUFeFIqcxYMW2PHJ8piUOpUcwuR1O/yyU +2qH76TVr+CvsuYkdlaGyKapbFyCwbzvt4LSppNg0tzstZmDno5S42YggssmE77I3zSs IXlbwd4JRSfOqxuLbcLvErVRbZaVMPSgsnUjt4HcOIv/AAAQskR2ZjdTcmFhpxlqflcG J5iWFpF8EU7hWjs58U4jho7MluXS6EUxG38vF6MrmlXcHtdOhPBgpY6bRPtW4QbU8rhC qgvqnzAHiLkrbZvAI6D/SfOgb+AtduYdUjFbPKujzOsB+iP2Efv/9KsVCc2unSMad/D6 TZ1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=wSsLOe5Lyn7H7ifVAKEYuRl4ZOhT8g45K/m16x4i8eA=; b=gti6Gva/qUZ53m2VNrCNj8SZOwMUzZhvAFR9r5tUFi5LKlslY9Fhm44CeGty8Lrq44 C3oPxgt9PPIbjpqg8mOFKOgCzVNUx+zkM82jCtNre10Zmfx97dr7hP1MnZolc7fCbQVD IPtyn9AFGNdGDDtabRrSv8+fTFGDy4I9PJfDt4nxupP2RKClOZiPyvxqnIM+MJ8CPo2d TxT7g9jlLqa4QebFDk63Y1Z+xjX8IMtQC/aJjUJnRBy0eiJUL22q/cXeHdsd33CyZ3bS z3M+8rYmN8cPXP1AW2Uy/3AnciYODoXDVAA2vB3TKyWNuuVOEiOczBsmWIkf1fpaT2ks Glsg== X-Gm-Message-State: AOAM531UONqI3dpq9pjGKncZC/CKQKlrpemQj07GGz5kBKtzV2Lrr4l7 vVBK2A6bK6eadnertYZvq3Q= X-Google-Smtp-Source: ABdhPJyqOkDDOxvMTotXiLhcRt9CtFFEoU/JkdteniSv1WOiDe0pB97SpoQOP3LXSrd/GQ60kMoniA== X-Received: by 2002:ac8:5488:: with SMTP id h8mr24349811qtq.250.1599569331214; Tue, 08 Sep 2020 05:48:51 -0700 (PDT) Received: from raichu (toroon0560w-lp130-08-67-71-176-35.dsl.bell.ca. [67.71.176.35]) by smtp.gmail.com with ESMTPSA id p29sm9115155qtu.68.2020.09.08.05.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 05:48:50 -0700 (PDT) Sender: Mark Johnston Date: Tue, 8 Sep 2020 08:48:48 -0400 From: Mark Johnston To: Michal Meloun Cc: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r365445 - head/sys/cam/mmc Message-ID: <20200908124848.GB66031@raichu> References: <202009080546.0885kAgk006783@repo.freebsd.org> <34826ee7-12a9-d309-1fee-cd2e95744603@FreeBSD.org> <67be7fa5-30dd-b7ee-1076-9c29195d83d3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <67be7fa5-30dd-b7ee-1076-9c29195d83d3@gmail.com> X-Rspamd-Queue-Id: 4Bm4hh2njMz3T84 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=bUtuKyrn; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-1.34 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.989]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.32)[0.320]; NEURAL_HAM_LONG(-0.97)[-0.973]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::841:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2020 12:48:53 -0000 On Tue, Sep 08, 2020 at 02:24:59PM +0200, Michal Meloun wrote: > On 08.09.2020 9:10, Andriy Gapon wrote: > > On 08/09/2020 08:46, Andriy Gapon wrote: > >> Author: avg > >> Date: Tue Sep 8 05:46:10 2020 > >> New Revision: 365445 > >> URL: https://svnweb.freebsd.org/changeset/base/365445 > >> > >> Log: > >> mmc_da: make sure that part_index is not used uninitialized in sddastart > > [snip] > >> Modified: head/sys/cam/mmc/mmc_da.c > >> ============================================================================== > >> --- head/sys/cam/mmc/mmc_da.c Tue Sep 8 04:44:37 2020 (r365444) > >> +++ head/sys/cam/mmc/mmc_da.c Tue Sep 8 05:46:10 2020 (r365445) > >> @@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb *start_ > >> } > >> > >> /* Find partition that has outstanding commands. Prefer current partition. */ > >> + part_index = softc->part_curr; > >> part = softc->part[softc->part_curr]; > >> bp = bioq_first(&part->bio_queue); > >> if (bp == NULL) { > >> > > > > One thing that concerns me is that it was obvious (to a human) that part_index > > could be used uninitialized if bp was not NULL. > > Yet, there was no warning or error from the compiler when I built that code for > > armv7. > > > > I wonder if we disable some relevant warnings for that architecture. > > Or if the compiler (clang 11) could not figure that out. > > > Hmm, for this in kernel code : > int foo(void); > int foo(void) > { > int rv; > > return (rv); > } > > warning is reported for both armv7 and arm64 for native or cross compile. > > It seems that clang11 doesn't emit warnings only for more complicated > cases... > > I writing this because i just found another usage of uninitialized > variable, in this case in much more complicated abort_handler() function > in arm/trap-v6.c again without warning emitted. I observed the same thing recently as well: the compiler catches uninitialized variables only in simple cases. In my case, any uses of goto within the function seemed to silence the warning, even if they appeared after the uninitialized reference.