From patchwork Fri Jan 31 06:15:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11359285 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AA15139A for ; Fri, 31 Jan 2020 06:15:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 66E27214D8 for ; Fri, 31 Jan 2020 06:15:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="q4uZbTk8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66E27214D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B398E6B055B; Fri, 31 Jan 2020 01:15:27 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AC47F6B055D; Fri, 31 Jan 2020 01:15:27 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 965A66B055E; Fri, 31 Jan 2020 01:15:27 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 793506B055B for ; Fri, 31 Jan 2020 01:15:27 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3476A8248047 for ; Fri, 31 Jan 2020 06:15:27 +0000 (UTC) X-FDA: 76436917494.21.eggs34_2f8dc97f47b34 X-Spam-Summary: 2,0,0,43c4f5d1c2798eac,d41d8cd98f00b204,akpm@linux-foundation.org,:akpm@linux-foundation.org:axboe@kernel.dk:colin.king@canonical.com::minchan@kernel.org:mm-commits@vger.kernel.org:sergey.senozhatsky@gmail.com:torvalds@linux-foundation.org,RULES_HIT:41:355:379:800:960:966:967:968:973:988:989:1260:1263:1345:1359:1381:1431:1437:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:5007:6121:6261:6653:7514:7576:7903:8599:9025:9545:10004:10913:11026:11658:11914:12043:12048:12296:12297:12517:12519:12555:12679:12783:12986:13069:13161:13229:13255:13311:13357:13846:14181:14384:14721:14849:21080:21451:21627:21809:21939:21987:21990:30012:30054,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0 :0,LFtim X-HE-Tag: eggs34_2f8dc97f47b34 X-Filterd-Recvd-Size: 3044 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jan 2020 06:15:26 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 D4A9A20663; Fri, 31 Jan 2020 06:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580451326; bh=2KYTCsbrhGqR8Nyfi11Ps5++0c7EprYjPNTwPsbR5qA=; h=Date:From:To:Subject:In-Reply-To:From; b=q4uZbTk8LK/lYUrbRx5bwFL45BlGFe6KirR58y8Vy3vn77s3q0wXaZVtGk9f7rxZ3 73LR6E7QMqXLmUZaazNum5t+d8Wrc1AMbIpqtg/p87iwq93KgmsoUdeOyNwW2vkKQR Z80X9NBforIyzRuWz3uuQBAkVZRdDKR8tkS7s+7A= Date: Thu, 30 Jan 2020 22:15:25 -0800 From: Andrew Morton To: akpm@linux-foundation.org, axboe@kernel.dk, colin.king@canonical.com, linux-mm@kvack.org, minchan@kernel.org, mm-commits@vger.kernel.org, sergey.senozhatsky@gmail.com, torvalds@linux-foundation.org Subject: [patch 080/118] drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store Message-ID: <20200131061525.XGegLk6eX%akpm@linux-foundation.org> In-Reply-To: <20200130221021.5f0211c56346d5485af07923@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Colin Ian King Subject: drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store Currently when an error code -EIO or -ENOSPC in the for-loop of writeback_store the error code is being overwritten by a ret = len assignment at the end of the function and the error codes are being lost. Fix this by assigning ret = len at the start of the function and remove the assignment from the end, hence allowing ret to be preserved when error codes are assigned to it. Addresses Coverity ("Unused value") Link: http://lkml.kernel.org/r/20191128122958.178290-1-colin.king@canonical.com Fixes: a939888ec38b ("zram: support idle/huge page writeback") Signed-off-by: Colin Ian King Acked-by: Minchan Kim Cc: Sergey Senozhatsky Cc: Jens Axboe Signed-off-by: Andrew Morton --- drivers/block/zram/zram_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/block/zram/zram_drv.c~zram-fix-error-return-codes-not-being-returned-in-writeback_store +++ a/drivers/block/zram/zram_drv.c @@ -629,7 +629,7 @@ static ssize_t writeback_store(struct de struct bio bio; struct bio_vec bio_vec; struct page *page; - ssize_t ret; + ssize_t ret = len; int mode; unsigned long blk_idx = 0; @@ -765,7 +765,6 @@ next: if (blk_idx) free_block_bdev(zram, blk_idx); - ret = len; __free_page(page); release_init_lock: up_read(&zram->init_lock);