Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1089555ybk; Sat, 16 May 2020 00:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr9EraLjKfJ1TIFa+SkfZVsRUZ2V8b+EWtEE81W3O4eGzpjDPfYv949S6/78UOyiu5Zz7u X-Received: by 2002:a17:906:4c8e:: with SMTP id q14mr6591692eju.208.1589613949940; Sat, 16 May 2020 00:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589613949; cv=none; d=google.com; s=arc-20160816; b=wsvmRrXNIOyXqb610oojELO+051jSLP1MpzcAMu5wCfcLzyDz0RFQRaX9bjhetPj7y Yc/1DEBkihVuvl0D80AI8M7hf7tkEQgXqDzs7Brzu/wom9Eulxazfo8QpYSMNdjZJwJv dEUh0cu8gdPz55qlUZ+a5VBSYsAlySwb5bX+P8+iCVdAlUwGWBCblr2OhxOlitd55Sk/ INgLAR7sm8M+kF2Lr6rlonROGJdgx6aAG7Z8Rh1vEt+X6RXMV/miTnJ7/WR+tpQw807/ xzf6+hdSsDLIkOupXsvg6aSVPLbw797A+mjkcrUxOI2NInNiIrDXDnniI/sHF1kvhWuw iqyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:from:subject; bh=mVWm1rUlNpE6KgjgjFibxdVKrWGgr2rHMLqQgDqgNno=; b=0SUy2GFVl9jJQDUlt6IE3GRtvurnz4fP2OQh74/yYFNWwKN1nOtOoE1z4vMy+GcGl6 rN/BoKjC/k/DQ01T/AUu8J/moL4q6YML+i4LfDqIfPVxxoelvlgfBTlko2zEA2ul76Iu Yvx6dc+8qxtxSUST8XkaY3A3AEL0n4TxH/Ux5U6fEAV2I8pJV5ZD54uk05HrvvZkRvzg +h4ZXmf11xfzt6yt7EhX+vjlmKIQh8BslOVB9rLuWRGkvCUMe5RV83YjDYYqZMJFvlIN PZdcXT1T4tx/reKdjo2U+dXtv/pBF5XQ3Vq05VqCZmTAIFFBmzbqJta+6HFYYYU9382c cJDQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si2723491edb.81.2020.05.16.00.25.26; Sat, 16 May 2020 00:25: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgEPHWw (ORCPT + 99 others); Sat, 16 May 2020 03:22:52 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44510 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725807AbgEPHWv (ORCPT ); Sat, 16 May 2020 03:22:51 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A2557B10F7855F44BA83; Sat, 16 May 2020 15:22:49 +0800 (CST) Received: from [127.0.0.1] (10.166.215.237) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Sat, 16 May 2020 15:22:42 +0800 Subject: [PATCH 2/2] lib: 842 - Remove useless checking in check_template() From: Yunfeng Ye To: , , Shiyuan Hu , Hewenliang References: Message-ID: <74705394-8f7c-9635-12c0-10fed1fe8f8f@huawei.com> Date: Sat, 16 May 2020 15:22:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.166.215.237] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A warning was found by smatch tool: "check_template() error: testing array offset 'c' after use." Fix it by removing the useless checking in check_template(). Signed-off-by: Yunfeng Ye --- lib/842/842_compress.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/842/842_compress.c b/lib/842/842_compress.c index 18255d25781b..8d25345b4b49 100644 --- a/lib/842/842_compress.c +++ b/lib/842/842_compress.c @@ -379,9 +379,6 @@ static bool check_template(struct sw842_param *p, u8 c) u8 *t = comp_ops[c]; int i, match, b = 0; - if (c >= OPS_MAX) - return false; - for (i = 0; i < 4; i++) { if (t[i] & OP_ACTION_INDEX) { if (t[i] & OP_AMOUNT_2) -- 1.8.3.1