Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8559640ybl; Thu, 16 Jan 2020 19:35:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyhxl/mR500dn/G9zz6V5bz1CKsYzDECdZkYjUJoQdjou64CTJgGJDuxUocYMQoIJ0lqlCw X-Received: by 2002:a05:6808:3c2:: with SMTP id o2mr1969380oie.45.1579232149009; Thu, 16 Jan 2020 19:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579232149; cv=none; d=google.com; s=arc-20160816; b=YufxdxAqzEfrvrBwgJySyqoEqvE4Yom+Mo7cDjEdKfSeae3MmNk1nyFdKVcKeKugOf Tr2MQtmcF8uX/Y48qg0e/9z8DNXQz9WReBC8vPgQp2oh7SiSIIzHCv04FMkr83qqYurE GdWN5qP0EwCUE5nbPVKYlhImAWwg2sNnmxsdAkQmAiDVYo97QiN+kff+NTTi3pIXjFwE 7lY/eoOG0/0y8S2MriCF2eKcJiSfkJ4JtkGyHwB9Vl2bPhjqN4+bPXsoE9D0d0naTxVD 8SKxfxd+fESCe919MSsWkvNq+w13gd/TjneaLKZtBukFpjFSgHlihc7JwoSR+16cFm7b TN6Q== 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=SGN7QsUiYy92JmjrD0R7we07+H5xQP1OKGWM48sHDEs=; b=bxatB0nF3fZhGm8QXcZyeiEQOf/tgF3C3tZW9IA/ELSQZavJYjZ/nfh3782tIgvRRX hWmMh+5lZRi/Ewb5q6u0hgrZ5GLvo0cibpB1M9VcefvnA4FWa6gIr6dqM9+1cGtOaQqW ++fId78quqDERXumElXWkWrfPEzF3w43UTON73/kg374q4tTpo5l4KSI9CWTzrH6sa75 A1gQsQlGsqUAsftjdKN5VgtSHNwu258fP8E15CcCeRMn6Gksd/71uV0n9oWTdYBWPLf7 5wNfzLkS0bcGQK/EXgOJT9pFbHifSHj3lpLre8oFYINjrerhAz1FVOSRvnBWki8PC+fQ Mbfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cIuZ2WKE; 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 o4si12968004otp.200.2020.01.16.19.35.37; Thu, 16 Jan 2020 19:35:48 -0800 (PST) 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=cIuZ2WKE; 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 S2391875AbgAPXnM (ORCPT + 99 others); Thu, 16 Jan 2020 18:43:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:55668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389006AbgAPXZr (ORCPT ); Thu, 16 Jan 2020 18:25:47 -0500 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 7819D20684; Thu, 16 Jan 2020 23:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217146; bh=lkSHes5e9d4xcqebKv/yK6/bBAOg+pa91rHSqGY9AQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cIuZ2WKEp/4I8IyB/Dq+AVTsCmMOo8odybWwQIKFqZ4LkKm46Icbq+ZXgyWmP7soc 5NsWEEKnvLR4P7nrMmRnK6R78bkp8JsjYLw47Vy4dKLiH555kv0HfIOkrn1QTZKjRo +TYVTrsky9mG/+v3I8oLVY7tGBVP6X+Xcbro+dqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Shtylyov , Tudor Ambarus Subject: [PATCH 5.4 167/203] mtd: spi-nor: fix silent truncation in spi_nor_read_raw() Date: Fri, 17 Jan 2020 00:18:04 +0100 Message-Id: <20200116231759.221421726@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@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: Sergei Shtylyov commit 3d63ee5deb466fd66ed6ffb164a87ce36425cf36 upstream. spi_nor_read_raw() assigns the result of 'ssize_t spi_nor_read_data()' to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. This silent truncation isn't really valid, so fix up the variable's type. Fixes: f384b352cbf0 ("mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables") Signed-off-by: Sergei Shtylyov Signed-off-by: Tudor Ambarus Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2865,7 +2865,7 @@ static int spi_nor_hwcaps_pp2cmd(u32 hwc */ static int spi_nor_read_raw(struct spi_nor *nor, u32 addr, size_t len, u8 *buf) { - int ret; + ssize_t ret; while (len) { ret = spi_nor_read_data(nor, addr, len, buf);