From patchwork Tue May 24 02:00:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12859620 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 2F7F4C4332F for ; Tue, 24 May 2022 02:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232697AbiEXCAb (ORCPT ); Mon, 23 May 2022 22:00:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232656AbiEXCA3 (ORCPT ); Mon, 23 May 2022 22:00:29 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06949880E1 for ; Mon, 23 May 2022 19:00:28 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id 68so9291534vse.11 for ; Mon, 23 May 2022 19:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=edPdA60haplwpDiUrBxThlI9v7AIAgcIcDq6QFbgDcg=; b=aHzdYN6IQ5meGFCFD1V1+Pq+yTOLb8I0QBhESQWXv+nyucLPFzBmjsQ8t2i7EBoykY Wo8FWPPYmRPbftAAGKS0mC9b3fNBVNnzC1f6YQq+9eWbWEMMZ7tRfhyN6eJTKOyJvhyG X4oDHkhWqkvRHlu2Ly5+suXf1r3001ZQlAUiq5Wu0zCesF3Hlf2J0gEPI0e1oGPrI5Jc MUBJElJWgofq9oDLOLu3qflY5wBaoukZUOL8VUrzIluUpsW/MKD6W+rb0yzEki4oHhMB y+5Nlezd/W+ZA2AgopTUNd9/FBnF0EBks+rv39KHnZcX3sgGpt5QPtpSQaTf71IIyOx1 cNXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=edPdA60haplwpDiUrBxThlI9v7AIAgcIcDq6QFbgDcg=; b=3ugT95NB4yREEE4Lro0Iah95itHMyKDzhUkhg9VJmApK523GeQ9uqIVz+R4VX2rNLH KmG3lfHcjcf1l5k2NrEccbw1IOTuxqzPyxdVIJst3+/oL5Ctyzkx0A4tydFnB890E71S iw6rpjErwUNeBBd2BpfJLsTGFaOnxutV8vlpa4OtnqJWzRAN2rAk5BUd+HUvRLO9L6uv YaS/inu8rDckbKRefAcXMBFUfmp1LfJOgMipqPqMNotpGYBX05MtaFWrgxA2+3lYrVNn KwGYQSjMoXvVSnA70kYSbm5SCnDtnATtzqNCtswZj+arTgRc4WteyWLfkXFu7sgSULjw Exbw== X-Gm-Message-State: AOAM533/KbjJp1+Qn8R3wxb1frSTa6nZGOvSxy6HK7UOwly9+iKqWslB kXSb8buENFeB4+EQA/ydS0WMBp5bMihD5beaFu8= X-Google-Smtp-Source: ABdhPJzZBHLhDfuf1qi0ydL063ZRrgQuxXwyBh6s54Zp/PlQYmqg2P8CNfSQSNYrQWT7LFF6TDllam8S3w6CFINQlE0= X-Received: by 2002:a67:fe57:0:b0:335:ef50:1b94 with SMTP id m23-20020a67fe57000000b00335ef501b94mr8331090vsr.6.1653357627049; Mon, 23 May 2022 19:00:27 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Mon, 23 May 2022 21:00:16 -0500 Message-ID: Subject: [SMB3][PATCHES] two patches for minor coverity warnings To: ronnie sahlberg , CIFS Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Fixes for two minor Coverity warnings From bbdf6cf56c88845fb0b713cbf5c6623c53fe40d8 Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 23 May 2022 20:42:03 -0500 Subject: [PATCH 1/2] smb3: check for null tcon Although unlikely to be null, it is confusing to use a pointer before checking for it to be null so move the use down after null check. Addresses-Coverity: 1517586 ("Null pointer dereferences (REVERSE_INULL)") Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French --- fs/cifs/smb2ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index cbe56ed35694..0d7feb9e609e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -760,8 +760,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb, struct cached_fid **cfid) { - struct cifs_ses *ses = tcon->ses; - struct TCP_Server_Info *server = ses->server; + struct cifs_ses *ses; + struct TCP_Server_Info *server; struct cifs_open_parms oparms; struct smb2_create_rsp *o_rsp = NULL; struct smb2_query_info_rsp *qi_rsp = NULL; @@ -780,6 +780,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, is_smb1_server(tcon->ses->server)) return -ENOTSUPP; + ses = tcon->ses; + server = ses->server; + if (cifs_sb->root == NULL) return -ENOENT; -- 2.34.1