From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-28.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C4FC433B4 for ; Thu, 1 Apr 2021 19:27:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91CE6610E6 for ; Thu, 1 Apr 2021 19:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235133AbhDAT1w (ORCPT ); Thu, 1 Apr 2021 15:27:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbhDAT1k (ORCPT ); Thu, 1 Apr 2021 15:27:40 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F2AC03D206 for ; Thu, 1 Apr 2021 12:06:06 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id g8so4341833lfv.12 for ; Thu, 01 Apr 2021 12:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=QdVoyrhhfbDEFqnPYd9w4ehNfmf+FjnOe9vuh1ECpZjh4u8A2geVILkm+LOXR76MUv aDaWPbbdGQ8as9RLCzdBMzdKAeAQuy+QYSFlptzE/7GSNNVav3REeTmGSvCShaDkCPe1 xaphaeO+zk4yx/WziudmaNHwePNXdkuDzaXK8ndzAgOm4C9AyxGC7TJ3lcyMlPjy4lnT 9WXKXl2eOZO3IaTGztvDWDLj83XhhoZOacpxEmjDDmRitjLzaSvwyI4efC8kW5yeZY2t +1+33vm/80LAw8q18kME3zeGlQX1uVhaOSWWcPi3+R/0lVOt9fmMrWz31MzYH25uo9nj 2O+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=Q2hYPdrv3swuUzu3V+WeIfWWbLCNUd4jO0anVnuDMxZaIJnubjTRB1krt/5He56EkC +1+iIb4vjzfl/RTfLp1K+iLMoxj2+zWlqWuSwIsbsgUCz+477fv0QBd/N62vkfEfh2gc FYKuhx8GjTwai5E9utnspKdYzdr5VOaH/UC1pHUJTBvKuXUHAvxP3PPQ3XGvadYqlzNu 7bTNT4nIf8rqmJcXO2/b6m88WL6cQOV4ZqbdARx1VDKykfocpbswoT2qLsGbXFc1phlI HQIa6JW4HWVrLoafCEVR0vhS1grtISpOBP4ZDxQgWEUnGnRbOTFY8UuhkvmZ8x55ReOr ytsg== X-Gm-Message-State: AOAM532d9ShwO8lIM+8UryA84svzpeebd257+STsF04bS+tctYEmkyuW Z1CIqD2uhgbOPj/1DfgVj856RqM5GNL5cafKH8PFeQ== X-Google-Smtp-Source: ABdhPJz5ZHtEXsDY5GLsqYFc5mT6sVAzavQNzfR0vjCD8kxtCmVEUswcjEz41xlCccQI7rIOFft+pHHoX7YVkqcyFTs= X-Received: by 2002:ac2:538e:: with SMTP id g14mr6217538lfh.543.1617303965137; Thu, 01 Apr 2021 12:06:05 -0700 (PDT) MIME-Version: 1.0 References: <20210401161127.8942-1-maciej.falkowski9@gmail.com> In-Reply-To: <20210401161127.8942-1-maciej.falkowski9@gmail.com> From: Nick Desaulniers Date: Thu, 1 Apr 2021 12:05:53 -0700 Message-ID: Subject: Re: [PATCH] ARM: OMAP: Fix use of possibly uninitialized irq variable To: Maciej Falkowski Cc: khilman@kernel.org, aaro.koskinen@iki.fi, tony@atomide.com, Russell King , linux-omap@vger.kernel.org, Linux ARM , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 1, 2021 at 9:12 AM Maciej Falkowski wrote: > > The current control flow of IRQ number assignment to `irq` variable > allows a request of IRQ of unspecified value, > generating a warning under Clang compilation with omap1_defconfig on linux-next: > > arch/arm/mach-omap1/pm.c:656:11: warning: variable 'irq' is used uninitialized whenever > 'if' condition is false [-Wsometimes-uninitialized] > else if (cpu_is_omap16xx()) > ^~~~~~~~~~~~~~~~~ > ./arch/arm/mach-omap1/include/mach/soc.h:123:30: note: expanded from macro 'cpu_is_omap16xx' > ^~~~~~~~~~~~~ > arch/arm/mach-omap1/pm.c:658:18: note: uninitialized use occurs here > if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", > ^~~ > arch/arm/mach-omap1/pm.c:656:7: note: remove the 'if' if its condition is always true > else if (cpu_is_omap16xx()) > ^~~~~~~~~~~~~~~~~~~~~~ > arch/arm/mach-omap1/pm.c:611:9: note: initialize the variable 'irq' to silence this warning > int irq; > ^ > = 0 > 1 warning generated. Ooh, yeah if cpu_is_omap15xx() then irq is unused uninitialized; I don't see any INT_1610_WAKE_UP_REQ-equlivalent for INT_15XX_WAKE_UP_REQ. Ok, LGTM. Reviewed-by: Nick Desaulniers I agree with Nathan on the Fixes tag. > > The patch provides a default value to the `irq` variable > along with a validity check. > > Signed-off-by: Maciej Falkowski > Link: https://github.com/ClangBuiltLinux/linux/issues/1324 > --- > arch/arm/mach-omap1/pm.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c > index 2c1e2b32b9b3..a745d64d4699 100644 > --- a/arch/arm/mach-omap1/pm.c > +++ b/arch/arm/mach-omap1/pm.c > @@ -655,9 +655,13 @@ static int __init omap_pm_init(void) > irq = INT_7XX_WAKE_UP_REQ; > else if (cpu_is_omap16xx()) > irq = INT_1610_WAKE_UP_REQ; > - if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", > - NULL)) > - pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); > + else > + irq = -1; > + > + if (irq >= 0) { > + if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL)) > + pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); > + } > > /* Program new power ramp-up time > * (0 for most boards since we don't lower voltage when in deep sleep) > -- -- Thanks, ~Nick Desaulniers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B59E4C433ED for ; Thu, 1 Apr 2021 19:08:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4818E6101E for ; Thu, 1 Apr 2021 19:08:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4818E6101E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pyL0cmuvK7Qs/N07mvtqOWZN0Kzduy3TPwLKhdvleoo=; b=mFrz3I+UtdAeThqi8It88mL1l ZYUPD8gBGTlMtgIMKeFze10A1FkvwseATZa1AsplzGNMDcCmU/7eyGxDOqAH3x7x+mS3GOza5GBtg J3TmxbQ1T74cJLlNaP3BS1ffZFq6TO2u+jbB1YEeIYZcw8nKzEoXNkQ4huAi0Akpr32mgqODN1XSV C1+4f0ga22C4VBL69Ph1eHjzKlilwHT9EPnmCYi7+AhUm5hA4kgmcC1zNxoeEXN5oCAIvT+AFjYGw +Z0MNVR8GN4NacAoeWNm2jmMz+kyWnVYc9kG0nNg+xp5LJztYMhW9lsQRnomfivYG6u6gHd481aFw rwXx7ctpw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lS2dv-00AlAk-IE; Thu, 01 Apr 2021 19:06:11 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lS2dq-00AlAR-9F for linux-arm-kernel@lists.infradead.org; Thu, 01 Apr 2021 19:06:08 +0000 Received: by mail-lf1-x133.google.com with SMTP id d13so4384529lfg.7 for ; Thu, 01 Apr 2021 12:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=QdVoyrhhfbDEFqnPYd9w4ehNfmf+FjnOe9vuh1ECpZjh4u8A2geVILkm+LOXR76MUv aDaWPbbdGQ8as9RLCzdBMzdKAeAQuy+QYSFlptzE/7GSNNVav3REeTmGSvCShaDkCPe1 xaphaeO+zk4yx/WziudmaNHwePNXdkuDzaXK8ndzAgOm4C9AyxGC7TJ3lcyMlPjy4lnT 9WXKXl2eOZO3IaTGztvDWDLj83XhhoZOacpxEmjDDmRitjLzaSvwyI4efC8kW5yeZY2t +1+33vm/80LAw8q18kME3zeGlQX1uVhaOSWWcPi3+R/0lVOt9fmMrWz31MzYH25uo9nj 2O+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=jyX1sRZq3mer60sPnUsd+UzWcdDHD23rUQsPEYa5ekpddE14hsKPyLzDYb/Jwf98G4 soBsy+HSJqbxN0G8/TIDOWChWXDOR4tMiq1ZluzVIPeVQnJjP05m3vtLvi6y+ciC4OQp KA+xPq7HqBlM38mQGDgrafnmIxNmx57+lGbVZYrg0bMIvBosJjLLqQ58NQj5kNd30neA CdPbS0t+461blmaAyyoGOeZKNHkJdYYSObFfa7YOYAfGndqy4gA5Eneeym008/aJ7M7W doBEeK43a1OpRXOqV9JEjNp4juILAvUiU/dmZsJsSc2yb2j/64mRCX5UMQ6LDImUqY9J r5Eg== X-Gm-Message-State: AOAM532eR51ZdRFNaM+wJzGhSNK0Yfklk58shEmaJ3pIexY2QkylDG5Q vRG7ozYE2lFYbhMQ1KFjVeg4K8XKdiMMUOuJ7tanfg== X-Google-Smtp-Source: ABdhPJz5ZHtEXsDY5GLsqYFc5mT6sVAzavQNzfR0vjCD8kxtCmVEUswcjEz41xlCccQI7rIOFft+pHHoX7YVkqcyFTs= X-Received: by 2002:ac2:538e:: with SMTP id g14mr6217538lfh.543.1617303965137; Thu, 01 Apr 2021 12:06:05 -0700 (PDT) MIME-Version: 1.0 References: <20210401161127.8942-1-maciej.falkowski9@gmail.com> In-Reply-To: <20210401161127.8942-1-maciej.falkowski9@gmail.com> From: Nick Desaulniers Date: Thu, 1 Apr 2021 12:05:53 -0700 Message-ID: Subject: Re: [PATCH] ARM: OMAP: Fix use of possibly uninitialized irq variable To: Maciej Falkowski Cc: khilman@kernel.org, aaro.koskinen@iki.fi, tony@atomide.com, Russell King , linux-omap@vger.kernel.org, Linux ARM , LKML , clang-built-linux X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210401_200606_559168_86DB16B2 X-CRM114-Status: GOOD ( 25.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 1, 2021 at 9:12 AM Maciej Falkowski wrote: > > The current control flow of IRQ number assignment to `irq` variable > allows a request of IRQ of unspecified value, > generating a warning under Clang compilation with omap1_defconfig on linux-next: > > arch/arm/mach-omap1/pm.c:656:11: warning: variable 'irq' is used uninitialized whenever > 'if' condition is false [-Wsometimes-uninitialized] > else if (cpu_is_omap16xx()) > ^~~~~~~~~~~~~~~~~ > ./arch/arm/mach-omap1/include/mach/soc.h:123:30: note: expanded from macro 'cpu_is_omap16xx' > ^~~~~~~~~~~~~ > arch/arm/mach-omap1/pm.c:658:18: note: uninitialized use occurs here > if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", > ^~~ > arch/arm/mach-omap1/pm.c:656:7: note: remove the 'if' if its condition is always true > else if (cpu_is_omap16xx()) > ^~~~~~~~~~~~~~~~~~~~~~ > arch/arm/mach-omap1/pm.c:611:9: note: initialize the variable 'irq' to silence this warning > int irq; > ^ > = 0 > 1 warning generated. Ooh, yeah if cpu_is_omap15xx() then irq is unused uninitialized; I don't see any INT_1610_WAKE_UP_REQ-equlivalent for INT_15XX_WAKE_UP_REQ. Ok, LGTM. Reviewed-by: Nick Desaulniers I agree with Nathan on the Fixes tag. > > The patch provides a default value to the `irq` variable > along with a validity check. > > Signed-off-by: Maciej Falkowski > Link: https://github.com/ClangBuiltLinux/linux/issues/1324 > --- > arch/arm/mach-omap1/pm.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c > index 2c1e2b32b9b3..a745d64d4699 100644 > --- a/arch/arm/mach-omap1/pm.c > +++ b/arch/arm/mach-omap1/pm.c > @@ -655,9 +655,13 @@ static int __init omap_pm_init(void) > irq = INT_7XX_WAKE_UP_REQ; > else if (cpu_is_omap16xx()) > irq = INT_1610_WAKE_UP_REQ; > - if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", > - NULL)) > - pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); > + else > + irq = -1; > + > + if (irq >= 0) { > + if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL)) > + pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); > + } > > /* Program new power ramp-up time > * (0 for most boards since we don't lower voltage when in deep sleep) > -- -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel