Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8034069rwl; Tue, 10 Jan 2023 08:16:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXvQ8OgL/TEc2U6JZEj/2lS9yRQ1jC6Ot8WLgW+R7uE5/LY5ijKmOdpVjwAZkrDDTk4BPIGw X-Received: by 2002:a05:6a20:94c4:b0:aa:806:7b91 with SMTP id ht4-20020a056a2094c400b000aa08067b91mr86272201pzb.39.1673367378339; Tue, 10 Jan 2023 08:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673367378; cv=none; d=google.com; s=arc-20160816; b=QSKFgtZy+GKBMbMo4weuxpHLwxBlpP0Jssm+FvOVfmK82Muapl7x60rYtySQM9tqRL BzOEhSj9YEMvbTZFs94BlBOKJtAOOPPk1JpxwQQrJ+jNFKMxhNsWC46+Aa8PNWdl7Epf OT6sdOhXw7/Ypfs0OwcdXRBCUlALexQjRZ9iMMSa4wDC6lRL7Qsy1ysvIiSrTeFj3ykC O1dQhR5CigpdFFaJWMlDS9qSH7X0Xn0CVf6SXFZcTGhJeXqPu+9U+lcBXRF9PR9H9hsf 7HHv/e2Xl+Gq4KMg4ar0anchPSIeXoCiROF31JR3Xxf14S+gjggz9JssY8Ivm4oPoq00 D2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u2DMWHC6X2HHvDTjwLtwR/dRrlqd9+4Bi2a8328F9pI=; b=eroBH3NOfCTyNM/46e0iWTxWz5ffA/4YgNaHaTNA8Se0XVFFggOPnlvFx38LWYqSIn R/HpxLMnAT8wMz2SLI0Cf5QnGDaFjk4K/dlgGWbTwNE4H/IvgYUEzkt2Zl8pONyjwOU0 pr5tuuoncjWFPmIe50e6rn+MNnp6Q2QwzqpQWRZQBP/PwvR45bLVQDTnwlBAuUSILgoU nbvJBFOhQNcOzGLGxA+xCqtYoZ6ES8CEPdBMFjTXsSJh6u8U/e4E5QIzB0ZTguGFFS2V WLBienoSKD/tVeRhpilQmHoBaxlYg4B3bHZgE197ggVdHDcjoYuL9jvyuOItYE4ws2t3 QHZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XCbb2Jpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a63e811000000b004780e6f20adsi12119822pgh.522.2023.01.10.08.16.09; Tue, 10 Jan 2023 08:16:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XCbb2Jpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238625AbjAJPUG (ORCPT + 53 others); Tue, 10 Jan 2023 10:20:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbjAJPTz (ORCPT ); Tue, 10 Jan 2023 10:19:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2992D5C1EF; Tue, 10 Jan 2023 07:19:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BB760B81731; Tue, 10 Jan 2023 15:19:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BAA2C433F0; Tue, 10 Jan 2023 15:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673363991; bh=eo9TFkkF19HVlM3o4QpdLSsi0wJXq0jNn4MmAXxKsPE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XCbb2JpewK0YgB59TKO+QL7EUH6xCmoLRrtU0YpOeBwPX3RmV5rWR4XVpP6i2nfhL Ew6wMSRnOIbtUK3wOut1ugWrGxgis4ghq7B3MkrvT7wwPdy2uABE87UYiNDdrTuIMj Uu12qYYRill++Cfup9uVGbpf2RWcwJ+uchuOr1ZY= Date: Tue, 10 Jan 2023 16:19:47 +0100 From: Greg Kroah-Hartman To: Harshit Mogalapalli Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel test robot , Pavel Begunkov , Jens Axboe , Dan Carpenter , Darren Kenny Subject: Re: [PATCH 5.15 514/530] io_uring/rw: fix errored retry return values Message-ID: References: <20221024113044.976326639@linuxfoundation.org> <20221024113108.274007846@linuxfoundation.org> <9ae29224-beff-66b1-cfcd-881bd5351e1c@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ae29224-beff-66b1-cfcd-881bd5351e1c@oracle.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2023 at 08:36:00PM +0530, Harshit Mogalapalli wrote: > > Hi Greg, > > On 24/10/22 5:04 pm, Greg Kroah-Hartman wrote: > > From: Pavel Begunkov > > > > [ upstream commit 62bb0647b14646fa6c9aa25ecdf67ad18f13523c ] > > > > This commit 62bb0647b14646fa6c9aa25ecdf67ad18f13523 also changes second > argument from unsigned to long. > > > Kernel test robot reports that we test negativity of an unsigned in > > io_fixup_rw_res() after a recent change, which masks error codes and > > messes up the return value in case I/O is re-retried and failed with > > an error. > > > > Fixes: 4d9cb92ca41dd ("io_uring/rw: fix short rw error handling") > > Reported-by: kernel test robot > > Signed-off-by: Pavel Begunkov > > Link: https://lore.kernel.org/r/9754a0970af1861e7865f9014f735c70dc60bf79.1663071587.git.asml.silence@gmail.com > > Signed-off-by: Jens Axboe > > Signed-off-by: Greg Kroah-Hartman > > --- > > fs/io_uring.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > --- a/fs/io_uring.c > > +++ b/fs/io_uring.c > > @@ -2701,7 +2701,7 @@ static bool __io_complete_rw_common(stru > > return false; > > } > > -static inline unsigned io_fixup_rw_res(struct io_kiocb *req, unsigned res) > > +static inline int io_fixup_rw_res(struct io_kiocb *req, unsigned res) > > { > > I think the res should be of type 'long'. > I noticed this when I ran smatch on 5.10.y io_uring backport from 5.15.y > patch. > > Smatch warning: io_fixup_rw_res() warn: unsigned 'res' is never less than > zero. > > static inline int io_fixup_rw_res(struct io_kiocb *req, unsigned res) > { > struct io_async_rw *io = req->async_data; > > /* add previously done IO, if any */ > if (io && io->bytes_done > 0) { > if (res < 0) //// unsigned comparison with zero. > res = io->bytes_done; > else > res += io->bytes_done; > } > return res; > } > > We don't have upstream commit to backport in this case. Should we fix this > with no-upstream reference commit? Just reference the commit that this fixes properly and that should be fine, thanks for the review and catching this! greg k-h