Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3285505ybb; Tue, 31 Mar 2020 02:06:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsAKXb0C70eKZxegLsWhigdoFy/7DwN6na3CwdHdcusCCLMdF/MCCqV+ED+3PFQqI/wxlkv X-Received: by 2002:aca:3101:: with SMTP id x1mr1322458oix.15.1585645581404; Tue, 31 Mar 2020 02:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645581; cv=none; d=google.com; s=arc-20160816; b=xQ2saPXHyd4/qJNWSlmYrEgawvgkTi+nt3UjnmkRi5W9k68BNWIwpJ2NBe2oKcO755 HYYRRsefMXT5a4iTZxl/7u68yem3vwUckLQ3ubHYhQxwn8a6sRpDVP+n2O+uEdjzyXuU F8OzIM4joAgKgFYToYqm8/e+wDMYUhGIu8157UF/MTLNpCT33K1FtKqhHfKQyBBAbZ7r gRggHV6ZDbNXLBc5+HGgGBcR83biAaPy9N/vTvCA2SA+KWmeg9draqUlNWua6hhA9mro HUzBlOjqqHVbA6rPznZRPwejNA+VQpDubsnrwYMiNBY3biS8qrWIu6wlqREMeq7l57R5 RjLg== 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=hGxBYLn9gVfHXL7wfW9Kd5PhEumGmHtlFX72ZTbCbnQ=; b=j6nxEkpNtLi2QlANlBT9LiiYVS6HHj18mQQHAAfq7X9TT+yYglhjahncGukiU0AZrW poDEd4M1/v7olwu/HbvXkju92VMuJQJg6nxQ0QvuX5mz7WVbWAvPvU8n6jXB5LWe558n mFpA+DtEMjnFRUAfkXlpC5PWWps3gdAiqPva6JFRqlj8W7EN4wSNkIxaBnskvdTpEQF7 UBZ8eJnS9Gjv8e2sNgFy/fC91UaRCyivud2fYaUkq/AyDT8HUYmf9FXdBaE8kACEJv7b Jq4oJullLvsDHxXKNh12ObhL175UKJyEv8+FQRzhlLgMBKGSmAJTAu+z10c9x9qNVaJv JZig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U1XHMwBv; 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 z3si7787695oth.163.2020.03.31.02.06.09; Tue, 31 Mar 2020 02:06:21 -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=U1XHMwBv; 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 S1731024AbgCaJE6 (ORCPT + 99 others); Tue, 31 Mar 2020 05:04:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:45744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731019AbgCaJE6 (ORCPT ); Tue, 31 Mar 2020 05:04:58 -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 3B42820787; Tue, 31 Mar 2020 09:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645497; bh=wx3fU5kf1GTuk5yaEKKJV+I0NEdDEdfUh2fN2C8mgCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U1XHMwBvbuVJiTg/r/TgpYeYTCxlFASeN5yGpFjnLa/naOgScAynic0K7/WxACMyx TqgrhHuhct4aU8gtlyqf1nDD873C3kAy2KDiLkPVlmANfDHrGO6UxDOzGvP0CHh1iv Tkhx5/vN24lcsceA2V8xffLlDzlv2eyVCxNkDIZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" Subject: [PATCH 5.5 033/170] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() Date: Tue, 31 Mar 2020 10:57:27 +0200 Message-Id: <20200331085427.574778203@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 [ Upstream commit 0dcdf9f64028ec3b75db6b691560f8286f3898bf ] The nci_conn_max_data_pkt_payload_size() function sometimes returns -EPROTO so "max_size" needs to be signed for the error handling to work. We can make "payload_size" an int as well. Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/nfc/fdp/fdp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -184,7 +184,7 @@ static int fdp_nci_send_patch(struct nci const struct firmware *fw; struct sk_buff *skb; unsigned long len; - u8 max_size, payload_size; + int max_size, payload_size; int rc = 0; if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) || @@ -207,8 +207,7 @@ static int fdp_nci_send_patch(struct nci while (len) { - payload_size = min_t(unsigned long, (unsigned long) max_size, - len); + payload_size = min_t(unsigned long, max_size, len); skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size), GFP_KERNEL);