Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3990095iog; Tue, 28 Jun 2022 06:59:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uk3hJXpq8RdSN4kQXKgZhyK6LfilXy4BcFwoKoT4gjYNcO029SsQs3vIi77M42G5uY6D5/ X-Received: by 2002:a63:854a:0:b0:40d:1d04:769 with SMTP id u71-20020a63854a000000b0040d1d040769mr17920565pgd.151.1656424765042; Tue, 28 Jun 2022 06:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656424765; cv=none; d=google.com; s=arc-20160816; b=KJBEbmIeKA0Rb4NHBNVcImYuVDhHzs756GvIapLArqOEyr7kKXnwAcbY4gvoj/Iiwd 9pJDBgVeCgMQioBAOq6Qu8mb+XnP1v9+dYXgx3wTIuNA2KNZeat/OdXitRveztE/DhpK wyWoxh47Vh+SBlR59rk/Lqx/rSaaYGqPFogktITv+7FaThsN/uokSbVA4jxok/p6pyXq KhIK64oLzpNdZIuZa4k7BoIqvX1RxUI737tW0487b2lIvYTqer1mmy7uAMzuAN/kZQct 8SstLY5NvyxE0gWYXuZaBa2ed5oBDQJ3cEFDxKa8md79ffGx+UR6KTaGc9pa4PFIARkK xs0A== 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=h0nMKRK3PbKsYHS2y+keeeZ1UYW8c/4QDq13WiKNI+c=; b=qZOmVRyzorpLS8KY9B2eyw7wCyFMQHhnCyGDuwMWMByleCAjd4QHH94dr9fczYjzb+ kuVGiT6S1VUbVZGIDukK5pvEAuHmCTIn24XlhJrjTGsMVDqvHQ3WJQFGQpwvUiUQIkmA 9AsCWf8peoaMYaYsjUTdnQYt9ua5EW9E2lgV9qPIg0Av6b0CDwHzib1P31v6QRrTHBtx VXtdpQpc9H8zR7KsMbFS16MRnTrYfS9veqecsRN9Xm32ntxetDVd5ntvSowcq9AaLMfu wF/r9RjcYgCoUsfQXrYCB1LhIJp1JrlKtmVcHr6OOi7bmYM9/NPP2+a3tgza/gAQJ/mw XQRA== 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 71-20020a63024a000000b0041147230b19si5013875pgc.350.2022.06.28.06.59.12; Tue, 28 Jun 2022 06:59:25 -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 S1346966AbiF1NxG (ORCPT + 99 others); Tue, 28 Jun 2022 09:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346964AbiF1NxE (ORCPT ); Tue, 28 Jun 2022 09:53:04 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B1B7650 for ; Tue, 28 Jun 2022 06:53:01 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LXQwN0hKQz1L8k5; Tue, 28 Jun 2022 21:50:44 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:52:59 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:52:58 +0800 From: Yang Yingliang To: , , CC: , , Subject: [PATCH -next 2/2] soc: fsl: guts: check return value after calling of_iomap() in fsl_guts_get_soc_uid() Date: Tue, 28 Jun 2022 22:02:49 +0800 Message-ID: <20220628140249.1073809-2-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628140249.1073809-1-yangyingliang@huawei.com> References: <20220628140249.1073809-1-yangyingliang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) 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,T_SCC_BODY_TEXT_LINE 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 of_iomap() may return NULL, so we need check the return value. Fixes: 786dde1e59d7 ("soc: fsl: guts: add serial_number support") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/soc/fsl/guts.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 8038c599ad83..6bf3e6a980ff 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -126,6 +126,10 @@ static u64 fsl_guts_get_soc_uid(const char *compat, unsigned int offset) return 0; sfp_base = of_iomap(np, 0); + if (!sfp_base) { + of_node_put(np); + return 0; + } uid = ioread32(sfp_base + offset); uid <<= 32; -- 2.25.1