Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3288984ybb; Tue, 31 Mar 2020 02:10:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsiV1KdR/dNbTmfU/Gk739mGL9UqunMQJ09vYuwe7LC//KPzDoYsEZa6fW8l53wjGF1/CSQ X-Received: by 2002:a9d:6a97:: with SMTP id l23mr12065084otq.69.1585645853696; Tue, 31 Mar 2020 02:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645853; cv=none; d=google.com; s=arc-20160816; b=QpWxytFa0B5+hdIeu5VkM2riYNKCcMTUhFHH74UcKbYscGlX8HPCm1MHaMKaM+w+1h ygwkLH5Kt72/YcGwrHch5if2+CKuib+EZ2wKxqcXH1ZTGw4sJUHK8rCjV0FXCj5FaQFH PQx4WSZa8v3uSxFuQdeV0PVHTu6cPk3wxEJrxS4pbS+rH01bXA/E9+yBggctcKjF7CN5 1Fq4xVQrdaVwCHCeN6BHrzzcdcM5speh8mIQcShaZxuAAtQckfYataY0XkAlx5BNcK3/ qglKAk1chPDmSU6SKqdhFrxKas6NEJBMX13iNrr0Km8gtIrZSR052+adQFJ4vQ854Ea0 GXQg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lSyl/VNUdiGohJ1jy6/TzdV+jug16cS+Q3ECmnraehc=; b=0Qq3HDYDsXleO7hvM3Qrlwvf7U6q4kUH1bGaYKfC/nFpMKKirHYuu8RVdA5onGHHLT s9tH+85eF+OSAlDRS4/o3wJ0jGkzU8G9rOnSNEg4pDtFs9c7bHbsNbEJZ+bysfu8DZlu 5lhnmoFQ7KNGMYSpZlzEeT/aE/V90oF/lgddzgs78YF4S6uEPybbM35PVu9mJqrimODz OQ0oritAoOOCVtoWq49/SaLno6q3sWrtT3i9d4GzfAMqmmU4uev0+m2lV1jzDr8vaIuY wisdWdQLToZE3t52eq2+lASRz7RtosvHhBc0Gq3TwiUAz7amsoX2RsPVLgdoB7kroi8O fZMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z09UONIa; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si7269291otq.75.2020.03.31.02.10.41; Tue, 31 Mar 2020 02:10:53 -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=@kernel.org header.s=default header.b=Z09UONIa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731580AbgCaJKU (ORCPT + 99 others); Tue, 31 Mar 2020 05:10:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:53932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731147AbgCaJKN (ORCPT ); Tue, 31 Mar 2020 05:10:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A34A2072E; Tue, 31 Mar 2020 09:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645812; bh=rAT7k9QfL/uRKMskwddcHA1BKZ5ENz8y42pgaEwLH+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z09UONIayBqSaGIQp91fFrgOridDgs+gBP12ULhbczpzOXhId9dKt7KXJ7e7tz2ko 3oyS466P7VqXk0Zyn+Rdh8xsGqCmVj5uqdQO720zdTezbqUWEfgvS3bxlVyB6WEjjU 5KuXy7SAqjsnuhxrP0WeRzpOgQpqyfdTEFL/XCVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 5.5 157/170] staging: kpc2000: prevent underflow in cpld_reconfigure() Date: Tue, 31 Mar 2020 10:59:31 +0200 Message-Id: <20200331085439.631756439@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit 72db61d7d17a475d3cc9de1a7c871d518fcd82f0 upstream. This function should not allow negative values of "wr_val". If negatives are allowed then capping the upper bound at 7 is meaningless. Let's make it unsigned. Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Dan Carpenter Cc: stable Link: https://lore.kernel.org/r/20200224103325.hrxdnaeqsthplu42@kili.mountain Signed-off-by: Greg Kroah-Hartman --- drivers/staging/kpc2000/kpc2000/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/kpc2000/kpc2000/core.c +++ b/drivers/staging/kpc2000/kpc2000/core.c @@ -110,10 +110,10 @@ static ssize_t cpld_reconfigure(struct d const char *buf, size_t count) { struct kp2000_device *pcard = dev_get_drvdata(dev); - long wr_val; + unsigned long wr_val; int rv; - rv = kstrtol(buf, 0, &wr_val); + rv = kstrtoul(buf, 0, &wr_val); if (rv < 0) return rv; if (wr_val > 7)