From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B9E6C43331 for ; Thu, 28 Jan 2021 15:18:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C834064DE5 for ; Thu, 28 Jan 2021 15:18:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C834064DE5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C10B56B0070; Thu, 28 Jan 2021 10:18:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBF6C6B0071; Thu, 28 Jan 2021 10:18:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD4DC6B0072; Thu, 28 Jan 2021 10:18:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 953A06B0070 for ; Thu, 28 Jan 2021 10:18:26 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2FCEB362A for ; Thu, 28 Jan 2021 15:18:26 +0000 (UTC) X-FDA: 77755540212.04.pull67_290e6cd275a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 09B8E800BE61 for ; Thu, 28 Jan 2021 15:18:26 +0000 (UTC) X-HE-Tag: pull67_290e6cd275a0 X-Filterd-Recvd-Size: 2614 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 15:18:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2853DACB7; Thu, 28 Jan 2021 15:18:24 +0000 (UTC) Subject: Re: [PATCH][next] mm/zswap: fix potential uninitialized pointer read on tmp To: Colin King , Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Tian Tao , Stephen Rothwell , linux-mm@kvack.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210128141728.639030-1-colin.king@canonical.com> From: Vlastimil Babka Message-ID: <2dee1f77-863b-e7aa-a3d2-bb4591d4f720@suse.cz> Date: Thu, 28 Jan 2021 16:18:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210128141728.639030-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 1/28/21 3:17 PM, Colin King wrote: > From: Colin Ian King > > In the case where zpool_can_sleep_mapped(pool) returns 0 > then tmp is not allocated and tmp is then an uninitialized > pointer. Later if entry is null, tmp is freed, hence free'ing > an uninitialized pointer. Fix this by ensuring tmp is initialized > to NULL. > > Addresses-Coverity: ("Uninitialized pointer read") > Fixes: 908aa806dba0 ("mm/zswap: fix potential memory leak") That's a linux-next hash, patch is in mmotm [1] *) You know what it means... *) actually it's not there, yet it is in -next. What's going on? [1] https://ozlabs.org/~akpm/mmotm/broken-out/mm-zswap-fix-potential-memory-leak.patch > Signed-off-by: Colin Ian King > --- > mm/zswap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 8d1381b1178d..578d9f256920 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -935,7 +935,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle) > struct scatterlist input, output; > struct crypto_acomp_ctx *acomp_ctx; > > - u8 *src, *tmp; > + u8 *src, *tmp = NULL; > unsigned int dlen; > int ret; > struct writeback_control wbc = { >