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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B281C46CA1 for ; Fri, 15 Sep 2023 21:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235490AbjIOVok (ORCPT ); Fri, 15 Sep 2023 17:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233362AbjIOVoU (ORCPT ); Fri, 15 Sep 2023 17:44:20 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BA7A8 for ; Fri, 15 Sep 2023 14:44:15 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 52AD62191A; Fri, 15 Sep 2023 21:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1694814254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/8yiSmUJGz3N8bbZndRko+5JYa+PPV59J514KrksPoI=; b=Pkfb3kYCkrJiBxaZbqOHtrKNOtePBcqAEXdDU4tKR4ffV5aXBNCDcFTzxRrSJXLTL4UWtA YCRbARJfMbuM2TWqXGWxC753SyhA9BTMD18jphczYXg2XSXgsW5LVzegYuIdJIjePSI2nI FkGovh47sbu17EPzQ3D9WM+aSFz6njI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0FC6D13251; Fri, 15 Sep 2023 21:44:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id joI+Ai7QBGV+LAAAMHmgww (envelope-from ); Fri, 15 Sep 2023 21:44:14 +0000 Message-ID: <5fb4fa251acc8c2a3156843fbc336080ff554f15.camel@suse.com> Subject: Re: [PATCH v11 32/34] scsi: sd: Fix sshdr use in cache_type_store From: Martin Wilck To: Mike Christie , john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Date: Fri, 15 Sep 2023 23:44:13 +0200 In-Reply-To: <20230905231547.83945-33-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> <20230905231547.83945-33-michael.christie@oracle.com> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On Tue, 2023-09-05 at 18:15 -0500, Mike Christie wrote: > If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so > we > shouldn't access the sshdr. If it returns 0, then the cmd executed > successfully, so there is no need to check the sshdr. This has us > access > the sshdr when we get a return value > 0. >=20 > Signed-off-by: Mike Christie > Reviewed-by: Christoph Hellwig > Reviewed-by: John Garry While all these "fix sshdr use" patches are correct, I start wondering whether we shouldn't simply execute " if (sshdr)=A0 sshdr->response_code =3D 0; early in scsi_execute_cmd(). That way we could skip all those (ret > 0) clauses. Anyway, Reviewed-by: Martin Wilck