From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by gnuweeb.org (Postfix) with ESMTPS id 171047E24F for ; Mon, 7 Feb 2022 13:46:01 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=kernel-dk.20210112.gappssmtp.com header.i=@kernel-dk.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=hp3MMQ8Z; dkim-atps=neutral Received: by mail-pf1-f177.google.com with SMTP id e28so13041476pfj.5 for ; Mon, 07 Feb 2022 05:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+fYYVy93BDFqw0cCdynsbSRegfY0xYWHIfwAqDxymeY=; b=hp3MMQ8ZMedpHg9Nevp1XeEuuEA7IKnvKqo3RmIMgSgkNZVcw4jBrSu78B7Dx97yzi ChG12kiPN5PHLwvGlce9A0y5Co7qoc5PD33ihFDc/g1bGg4tbNHvi4ffk8p1O6Ksm5My 8BtSs5gvT2LhokIb2C3tAO+hrK5GTuyzQrRXirbOgMOoWQh3fse1cb5JMHqHIXxI8Fre uYUXkpw437r8QzNVs6c23wTMj6+Kfq6yj2oLsk7GzdQPcsInWy68JVklCfUL8CbW6oGC 7JMcutC1k+rlN6rp3tNzXDqgVacnpF5Doatrua7fNfYRD/YTFpNYv00gpZYUSBG4Ylf1 eI3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+fYYVy93BDFqw0cCdynsbSRegfY0xYWHIfwAqDxymeY=; b=Ge2OxFW8leQicSpFKp7tF1iI+EOfGTM0kKJkXBT1pp9j/cd3C2fl9aOpkpJ+Ho9wt8 /T+mbzAZcUb6viLuZpTpgm3ScRvp6OY3BqTjCPSzCY63S9TLMti9ebd2lfs//xtWHAyc iOTxEhc1Ld+fODnLyglUf+Lu9MqleSQYRKpRu7+4VkViefK+IiAqTVpBxEhaMb56/iHK 3ggRlBVFApwbIM5lUPFQxnEjJ/iZ4qAX0KwAaF0EkBDlChr9M6xg52vb+PFNWIyjERNC BIhuGBY95JYLEztKwQZH9YSLJHq78gEHyC1U0fCdIzjvO8i+Gf77Rmp7OWugwyxnPltm YH+Q== X-Gm-Message-State: AOAM533oCh+qLAWOM7U1wJ7CiViprrsxu3IHI1KBfxxoZ16cejD1M07Q 3aPv/l5KL8u+C4Hzp4k+/17d9g== X-Google-Smtp-Source: ABdhPJy13wPQSgj1YQJzHPhdlM4opHdCLY6oe1/iBRCUm78RUTw3mK/LTWyJn4eAdyiaxbyeS+SOEw== X-Received: by 2002:a63:e647:: with SMTP id p7mr9358380pgj.23.1644241560350; Mon, 07 Feb 2022 05:46:00 -0800 (PST) Received: from [192.168.1.116] ([66.219.217.159]) by smtp.gmail.com with ESMTPSA id c11sm12279229pfv.76.2022.02.07.05.45.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Feb 2022 05:45:59 -0800 (PST) Subject: Re: [PATCH io_uring-5.17] io_uring: Fix build error potential reading uninitialized value To: Ammar Faizi Cc: GNU/Weeb Mailing List , io-uring Mailing list , Tea Inside Mailing List , Linux Kernel Mailing List , Alviro Iskandar Setiawan , kernel test robot , Dan Carpenter , "Chen, Rong A" , Pavel Begunkov References: <20220207114315.555413-1-ammarfaizi2@gnuweeb.org> From: Jens Axboe Message-ID: <91e8ca64-0670-d998-73d8-f75ec5264cb0@kernel.dk> Date: Mon, 7 Feb 2022 06:45:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220207114315.555413-1-ammarfaizi2@gnuweeb.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: On 2/7/22 4:43 AM, Ammar Faizi wrote: > From: Alviro Iskandar Setiawan > > In io_recv() if import_single_range() fails, the @flags variable is > uninitialized, then it will goto out_free. > > After the goto, the compiler doesn't know that (ret < min_ret) is > always true, so it thinks the "if ((flags & MSG_WAITALL) ..." path > could be taken. > > The complaint comes from gcc-9 (Debian 9.3.0-22) 9.3.0: > ``` > fs/io_uring.c:5238 io_recvfrom() error: uninitialized symbol 'flags' > ``` > Fix this by bypassing the @ret and @flags check when > import_single_range() fails. The compiler should be able to deduce this, and I guess newer compilers do which is why we haven't seen this warning before. I'm fine with doing this as a cleanup, but I think the commit title should be modified a bit. It sounds like there might be an issue reading uninitialized data, which isn't actually true. -- Jens Axboe