Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6021306ybc; Wed, 27 Nov 2019 13:32:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxIWrVUk+syBMCqJEL6jyJzHDSbrY8ZnFLZT06L5vY2s5em6e9NMb5ZwT+9pXB/G0y7u2bk X-Received: by 2002:a50:978f:: with SMTP id e15mr34528461edb.298.1574890364767; Wed, 27 Nov 2019 13:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890364; cv=none; d=google.com; s=arc-20160816; b=M/MQ3XX33p2fwQ5qH1n2xgw1boa5ky/yVtkHaTIlfc2bKFS9K5Ow6Ny7Nt/FuVNdwW j7HdXi1mfO16yGhpl+tLLgvIg/qOP8dQl6CiFgJfElnQFTY2a5JhBK+RMGw5ogiIQQ45 Lp34z/iSE+c1E23kUAkS/tWwst5TBHem0jS7D5N9BZkEMD102jUkMoY3RRv9Mjn0tH63 fEZDlGBEEhbkJKuxZ/6eupRvFkzO8xmWfJ6M0GJLcZC1ZWUlr7POsj4kBSWWfIV+kINI ftbYRM9hG1EML8yt3wVqs5FF/cUe2sIcWtEXgV27E6JugB22AfsjLdhScG3/tuTzUtwp bZxA== 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=QQRPJXcrkaPhhhI8hD3x7kAAFaWsWkgrXFaPDw7vFhQ=; b=Kb6TTnoWyWEfxdvGwdXc5zT9A5r6GaMRGT2/UwY3s1U3qrqwaq1H+lUAd/FZM5B52X ZBh2xdaStICAMK6sdcyIZIOPD/pDv5Vxi4MTnOLKGHBLR/mY5qrxqYdqvnZau2qbLgsY 73UeNGzj+TDUtpGWsl/JvfZqmRbzJbddEwpP2yxDAcjLz+262Ygy6ejP73AQOYbgnUBV /PnO1jSpMGEInbhLF39mGLFPcP9rHaZjM7SBbvTZZuhyYk8VwTBHlz8x6LaOqjrWbU2i xQs9gZTrZ++pMbAHRXrxwnchnIV6HUnLBEBC7C/F3ErXWazZx33hJ4iRIDTizz8b18FP WCqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iYuCcnuB; 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 l2si1264030edi.367.2019.11.27.13.32.21; Wed, 27 Nov 2019 13:32:44 -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=iYuCcnuB; 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 S1731143AbfK0VaI (ORCPT + 99 others); Wed, 27 Nov 2019 16:30:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:46924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbfK0U4K (ORCPT ); Wed, 27 Nov 2019 15:56:10 -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 75D3A20862; Wed, 27 Nov 2019 20:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888169; bh=uWZClTrsqmEFx8byq1mK09fgpItzYGHhc8KLTIkX/1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iYuCcnuBT+ZdvSluclMPXbfewTaD4yXupsNjbhDC2ciMrUQ+dsxlbUSTHNGt808CA l2yTTj6LGaCl6Fswl8E1biSg+t9g3EV1nBZ2/DFHdqtmwC88PyzciWOyqSadXkb73H xoMj+Oe4gyuZ2bPO1Xid50MS7uw61CNCaCORcO2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Geoff Levand , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 031/306] powerpc: Fix signedness bug in update_flash_db() Date: Wed, 27 Nov 2019 21:28:01 +0100 Message-Id: <20191127203117.022103888@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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 014704e6f54189a203cc14c7c0bb411b940241bc ] The "count < sizeof(struct os_area_db)" comparison is type promoted to size_t so negative values of "count" are treated as very high values and we accidentally return success instead of a negative error code. This doesn't really change runtime much but it fixes a static checker warning. Signed-off-by: Dan Carpenter Acked-by: Geoff Levand Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/ps3/os-area.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c index cdbfc5cfd6f38..f5387ad822798 100644 --- a/arch/powerpc/platforms/ps3/os-area.c +++ b/arch/powerpc/platforms/ps3/os-area.c @@ -664,7 +664,7 @@ static int update_flash_db(void) db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff); count = os_area_flash_write(db, sizeof(struct os_area_db), pos); - if (count < sizeof(struct os_area_db)) { + if (count < 0 || count < sizeof(struct os_area_db)) { pr_debug("%s: os_area_flash_write failed %zd\n", __func__, count); error = count < 0 ? count : -EIO; -- 2.20.1