Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1746484pxj; Wed, 19 May 2021 12:57:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVqumUt+uZFBvJqHnc1x2lNxIVrUtbrgRpkPsJiD/pO7vVy9lfoflIT9nDZPWCzhmuyPWt X-Received: by 2002:a17:906:b756:: with SMTP id fx22mr861005ejb.224.1621454269354; Wed, 19 May 2021 12:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621454269; cv=none; d=google.com; s=arc-20160816; b=z4UTs0ljLCIpHayY79AevMr6yYBHF3ILBdMMA9PtYDqlEw0s6Jw/BJ5xasax0tXWF9 7ZmfqrBkZ2oUWvblKtnu1x1Z8J8ifB7Br4vmYYmbBz2xFWySyk8jDGLlz0CWyyVy1idc 4C21OQfe6qjDQggP9euLnGxL9G3vj2zjjXl2TeoPDxByl2jZMef2Y59khu2DwvocVMBl 0tTk5S9HQyKxfwGxo3ZTFfZSIuBFcs1q+iMncQ4UkzQoXwRt+vv5aVu/kPvse310BC5e Y/E1KRb4mlhjcxJoI3sp0NnaORApeWRptcPsq9HHeH6NTDQJ1wp9L2pRmALZS7wKXcdP GLHg== 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 :message-id:date:subject:cc:to:from; bh=Q7tQMiupoC6UDNxYlqdoJfri/21065LuEaaiXvy67zY=; b=wdHcLeD7yqZM3d8XEUVOejs43EY6KkWf2hswtvNsL7YHgSV0E09NHbqhJLoCDCBiTd Autaz3nDCZ/ZAh5HyAa3x6LzhV0nsTaij1zRiPP33gU/ZAuqKSp821bHQrxFIx5Kjdvs A3vEu7b4v/V88PCvaALab3zDR/X+xFBqkmWS0TOKVGeuYxe3pkkRrFXzAJOSYSugXkmY hn1gKXBQVEkvVC+yyuxPoGH82mrWg/Y/f8Y7WcQCx60UngV6TbvI8tPeUsrVqBjgAIRo 6webYudPKFVs0xy0WDKPo8E9AMCP7sT0ZYDho5XRBUTP6FeiAyLG7l8wNtqGifWQHoQD hoIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx9si165135edb.174.2021.05.19.12.57.25; Wed, 19 May 2021 12:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347021AbhESOJL (ORCPT + 99 others); Wed, 19 May 2021 10:09:11 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:3427 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353892AbhESOJE (ORCPT ); Wed, 19 May 2021 10:09:04 -0400 Received: from dggems706-chm.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FlZPh4n5KzCtt3; Wed, 19 May 2021 22:04:56 +0800 (CST) Received: from dggeml759-chm.china.huawei.com (10.1.199.138) by dggems706-chm.china.huawei.com (10.3.19.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 19 May 2021 22:07:43 +0800 Received: from localhost.localdomain (10.175.102.38) by dggeml759-chm.china.huawei.com (10.1.199.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 19 May 2021 22:07:42 +0800 From: Wei Yongjun To: , Gao Xiang , Chao Yu CC: , , , Hulk Robot Subject: [PATCH -next] erofs: fix error return code in erofs_read_superblock() Date: Wed, 19 May 2021 14:16:57 +0000 Message-ID: <20210519141657.3062715-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.102.38] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggeml759-chm.china.huawei.com (10.1.199.138) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true, thus 0 will return in some error handling cases. Fix to return negative error code -EINVAL instead of 0. Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- fs/erofs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index bbf3bbd908e0..22991d22af5a 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -285,6 +285,7 @@ static int erofs_read_superblock(struct super_block *sb) goto out; } + ret = -EINVAL; blkszbits = dsb->blkszbits; /* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ if (blkszbits != LOG_BLOCK_SIZE) {