Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1088764ybk; Sat, 16 May 2020 00:23:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWHsEx0zUfmMg2jcCD3xliZ9T11TomHeplYD2VBicAd2TrA5N8J4WpiCVNhCNkm1uOB0a7 X-Received: by 2002:a17:906:5004:: with SMTP id s4mr6536131ejj.13.1589613835461; Sat, 16 May 2020 00:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589613835; cv=none; d=google.com; s=arc-20160816; b=nk0aMx2HGbZ9mVpNfXoDZUVWMUyY2uDNFkeA86C/uwbc+tymi7QubrQp3dZYR8BYRa rR4m+1pX8ygmQ1LLIlrDAT69dcb5dJEKb+AjhXfpnoSp5Q4sLEHUrbwjnCuMAXZoRK4d 7kQvaXLyWMYANHpvOpJS/wfaeX1tL/QyDf3KGvmLPNOCFs3tLhCB/yoMFe9uCPCqoiuq ffqxNQcxSknswa+UNu35c1OfIV4+0lphorOqw62EYxc95njXe/Or8jIPdu+affIpH6wy z9YY9g452T2TL+v7fwaJo56B/5g/A3Jtn6Cq/tgJIWI/Hu4bwmzagqpXEglf2bAf550X 1I6Q== 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:mime-version:user-agent:date:message-id:subject :from:to; bh=vWSER4c4pgLDrkawADbmy84E1sAgM00HyYvAgsXwJDc=; b=JQjpLgI3Bkeg2sjAzyT8I5NpuGdrWBd09ycV/kfr4y9w+f8ABUjSJ19y426WB9jDrs WI20aJCAhQMTaza0b4U+TjfX9KzTMSTHI547Ms+gMFd7ITwRpaNry0EQ6YU/YOob3PSA a8Rnm9hgTf7CDkR5MMwBWN8ASc/ldk13Y8I9ehBW6uP0OzxJ/N9d7MTNOxQjw7zC84hY 075/+5qN/vdvjxPZfJUO6Kg5oBLrSHn0O7KzROetn63Xddpk2cTMoOCSkpD+dg2QHCDD 52vNx5DjB8qvzqOMSzc7+SJ2w+VgUMqgXd2CEVezhFg2z/N08nzcxQ/r0cSP7z7lvH50 NidQ== 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 c12si1743937edr.580.2020.05.16.00.23.31; Sat, 16 May 2020 00:23:55 -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 S1726462AbgEPHWE (ORCPT + 99 others); Sat, 16 May 2020 03:22:04 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4850 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725807AbgEPHWE (ORCPT ); Sat, 16 May 2020 03:22:04 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B6D372E8431338979092; Sat, 16 May 2020 15:22:01 +0800 (CST) Received: from [127.0.0.1] (10.166.215.237) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Sat, 16 May 2020 15:21:51 +0800 To: , , Shiyuan Hu , Hewenliang From: Yunfeng Ye Subject: [PATCH 1/2] lib: 842 - Remove useless checking in add_template() Message-ID: Date: Sat, 16 May 2020 15:21:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 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: "add_template() error: testing array offset 'c' after use." Fix it by removing the useless checking in add_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 c02baa4168e1..18255d25781b 100644 --- a/lib/842/842_compress.c +++ b/lib/842/842_compress.c @@ -225,9 +225,6 @@ static int add_template(struct sw842_param *p, u8 c) u8 *t = comp_ops[c]; bool inv = false; - if (c >= OPS_MAX) - return -EINVAL; - pr_debug("template %x\n", t[4]); ret = add_bits(p, t[4], OP_BITS); -- 1.8.3.1