Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3385159imw; Mon, 18 Jul 2022 07:13:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uFmDctPPTGr/lDnkBWXhIm9IROf3jzpkMLEzSCkYYb4ewfXMPr/ZZuO2OvfDVD3/KKCHwS X-Received: by 2002:a05:6402:294c:b0:43a:91a9:a691 with SMTP id ed12-20020a056402294c00b0043a91a9a691mr37426832edb.182.1658153584523; Mon, 18 Jul 2022 07:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658153584; cv=none; d=google.com; s=arc-20160816; b=s65Z6IHzoHLphOTebOYt9zh/O8qFfIlxmq89Q01LhR7HvG6FjuVIclCEN8Hktp5bmp CODyyBSWxqzrO3QuPf94xAWhR8prJwxohcWsYGdX5/6iyJb59y6h2p47EQ73vVGztF+V IuMRfj+4apBFgXr5iDeXcdyeZBdnrVuU2VEa//LUCjOPTe5gFwSuEqg+D8l3IXK/cPzi 0i2Hi79IEO93vf8SHKp/43f3H42dFSR1nloljje0i9YxGzCMTvK94kcYNlOO6J38Pe7/ WA6KBdCMU4wNNQKAiRYEdM2Xjk9o8gUoH3js9MgJ2EtclrJdRhuMhdOyoxKxpr48xkyd uIDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vGvlJ5b9zZmJ07KtbCqrl89BWYlEfYmXfzp+oTLaiBU=; b=suwhPlS73GPHD5j93Fr1Smzj7q2Cc+/c2ljDy2KNMAXYz766BU3nbEiFLdiDXwVBM3 8tVKCqp1SIyGDsR7CNEv4HwANjcGhD0k/prv2BEqR1bxpTZdm1RTJee+gZXtNEGjXGGa 11kfk4f9StasQ7lbJN+rs/8YDvoSQh5EC+KEN5kYYL65U15zQ7dyB1U/W1X055olB0S5 Wib+b/K0spZEsD8aRycj6qB2HV3HoUw2obmgIuIB+rPOZruUfEmW3SLxEGFfqOS2KJx2 NZ7C1ZRm2GRlyUYkZ0iJks8po7if06cTA67RjE9J1ZTLcRyIrOwGzwzL3JOv15GFHlQ+ /7Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a1709060b0300b00726be208896si8799215ejg.973.2022.07.18.07.12.19; Mon, 18 Jul 2022 07:13:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235466AbiGRNKr (ORCPT + 99 others); Mon, 18 Jul 2022 09:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235477AbiGRNKa (ORCPT ); Mon, 18 Jul 2022 09:10:30 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346C61D30A for ; Mon, 18 Jul 2022 06:10:29 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Lmj3T6SjHzFq9L; Mon, 18 Jul 2022 21:09:25 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 18 Jul 2022 21:10:26 +0800 From: Xu Qiang To: , CC: , , Subject: [PATCH -next 1/2] irqdomain: fix possible uninitialized variable in irq_find_mapping() Date: Mon, 18 Jul 2022 13:07:58 +0000 Message-ID: <20220718130759.67777-2-xuqiang36@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220718130759.67777-1-xuqiang36@huawei.com> References: <20220718130759.67777-1-xuqiang36@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In irq_find_mapping,ret value may be uninitialized.However,even if the local variable irq is initialized, it only solves the uninitialized problem and ret value is still an incorrect virq, so my modification method is to set virq in __irq_resolve_mapping function. Fixes: d22558dd0a6c (“irqdomain: Introduce irq_resolve_mapping()”) Signed-off-by: Xu Qiang --- kernel/irq/irqdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index d5ce96510549..481abb885d61 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -910,6 +910,8 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain, data = irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq == hwirq) desc = irq_data_to_desc(data); + if (irq && desc) + *irq = hwirq; } return desc; -- 2.17.1