Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3216927imm; Thu, 17 May 2018 05:24:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoXiPlwVwrFsBLG/zjRckcgiCBK4s1Kk1vywpKiv1ZdW2KbfaV2WnHdN3N52PDNG/rv8SoX X-Received: by 2002:a62:a65c:: with SMTP id t89-v6mr5011723pfe.27.1526559892289; Thu, 17 May 2018 05:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526559892; cv=none; d=google.com; s=arc-20160816; b=ArWouK/3xeXDZPQcw0O8/OKU5tm12imUl5OOaxq0TBgPXx7vekTRrRhxxPrcLhTN+M 2MMZcNtND+n8+Fma8YgYI3HBdjeuh8Jqls4MsLjnGKprSRJF/yV+A9Nsiz8rdXprFy5y hM7eUHbt1yaJhjJckPXEqloLDxSJFQnUz2kgvg19TZAf626kGZIK+Rz89ASUVjAkAy1g gKxAVhVmLqh7nzpG7kLGjr/nIhmSI2abg3Ox1O7ShYYuWKQ0OhWNjeMfeqL0nVFboljP X3wEz/QagGyC+65lDVkt3YO9UVIT2V7oeZe41YXOEAvewQLdZjSBVk3CGrAuSsaMQhlm U1qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ZkZa6ohNsN5nm8xqYmbeMSZs6Dtke3AV6ZHOuLMn4KM=; b=aqgdEeOi2WHjk60MR5+oTRDt7cR2JpYqgslqH6fhEFW8hXtL09a4w6Xd5M73wYNt+r 3s060AAy+0fYQEiV86p/njwRvYksYENu6DPNQwO+qWNChMtnan60IIXSybmsv/2S9djz BRe8aHDqzbffLAKzZsy3gLwgp5C4R5+12iWB6obxu1k+j2heNJTNpvAAXC2lR4FWP8bZ n601lkuwU3O/nknAk+BfVsKb0S7jnfbsAjtAK3/sL5QPKd7ITivJkxmVM9ZIS/wM984k xmQv/XUlEEWJ3xZyXt26BfAoTHLwjLXGYi71KS/qKylu3vpK3OuLZyN7BIv0cfE5Xdrw dZVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=qLzEtHxy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g125-v6si3901194pgc.568.2018.05.17.05.24.37; Thu, 17 May 2018 05:24:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=qLzEtHxy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752073AbeEQMW5 (ORCPT + 99 others); Thu, 17 May 2018 08:22:57 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:45934 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbeEQMW4 (ORCPT ); Thu, 17 May 2018 08:22:56 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4HCLYsH172965; Thu, 17 May 2018 12:22:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=ZkZa6ohNsN5nm8xqYmbeMSZs6Dtke3AV6ZHOuLMn4KM=; b=qLzEtHxyTvH/ebA33rE6q+QobXNV7KX6R4ZYhNmiG21aTh/jbZ/Xla3iYKqkEljW1Z9j jC4ldvAR0OQSjWefVubX26N9W++gexiOp1fcphieqfS9zEZWuEs8nWrmkZYg1TyGm3C0 Hm+zcHxYMVzAIrCsKbSrDL7k4tNgfpSfGh5naIzHI/iTPLiNlM4GHamDRkJ+C3x608RH MALefafaAbeHJXrAt0//AwmXbPgj4m0PhTf68e6jO0YnPFBEkYaKI5L0dRKDF7xYHADz yH8yehkCY4hvdJsdtpIgez4WcyNfBnePtlZ0sxqCNXBlWfThtwKzVhb8FfUzUeUI48Cr eg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2hx29w8xqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 12:22:39 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4HCMcVV024614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 12:22:39 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4HCMbT6005770; Thu, 17 May 2018 12:22:37 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 17 May 2018 05:22:36 -0700 Date: Thu, 17 May 2018 15:22:29 +0300 From: Dan Carpenter To: Jason Wessel Cc: Daniel Thompson , Arnd Bergmann , Greg Kroah-Hartman , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] misc: kgdbts: silence array underflow warning Message-ID: <20180517122229.GA7655@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8895 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=623 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805170115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Smatch distrusts simple_strtol(). I don't know the code well enough to say if the distrust is justified here, but it seems harmless to silence the warning. Signed-off-by: Dan Carpenter diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 6193270e7b3d..e0508acaedaa 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c @@ -400,13 +400,15 @@ static void skip_back_repeat_test(char *arg) int go_back = simple_strtol(arg, NULL, 10); repeat_test--; - if (repeat_test <= 0) { + if (repeat_test <= 0 || go_back < 0) { ts.idx++; } else { if (repeat_test % 100 == 0) v1printk("kgdbts:RUN ... %d remaining\n", repeat_test); ts.idx -= go_back; + if (ts.idx < 0) + ts.idx = 0; } fill_get_buf(ts.tst[ts.idx].get); }