From patchwork Fri Oct 14 23:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13007540 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 A8617C4332F for ; Fri, 14 Oct 2022 23:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbiJNX5R (ORCPT ); Fri, 14 Oct 2022 19:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbiJNX5P (ORCPT ); Fri, 14 Oct 2022 19:57:15 -0400 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 493A29A2B7 for ; Fri, 14 Oct 2022 16:57:14 -0700 (PDT) Received: by mail-ua1-x936.google.com with SMTP id p4so2501478uao.0 for ; Fri, 14 Oct 2022 16:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=XsziMdiUA8Hdb9u7dKCErGAaHPUxFe/x36c+28DjXi4=; b=gpdwgoFiN7zp67h5SgrfnEdLyWF9AiiVIWTMGryEIWEb1K6kvAk2A15O2xo/GUEJPd /OZthzU132m3eC0XRHQvPImS5f2AsiORgwhxrhDMFi89PSb4FUbtWKGmHoImSYJzOBSQ EKxPjSZ0DA65eJx6B42JFfAm1IGFamD75G6Ikuwrc2u1JPSfK6VsJAj5AgVgaYgAuJ40 9/ewfLYjsUCtTP/VyF+/Tlx7yeZcd5E/EtmflkumqND5UILUaJo9tiDdbNhSObMwK2Q4 Bom76e16jVUGmvPUTUNj0mm3qVXPGWVQcjjFBXKa4wNxG405XNoH7zEEvtFy7UMrUapx kaXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XsziMdiUA8Hdb9u7dKCErGAaHPUxFe/x36c+28DjXi4=; b=ARuanuNehO/cvGK3+YdVoW+h5XUT7vh5q/aSa/eyieXa4EcaZLwXau9sdiqPZuwKUg /mK6j00fn04U0n/ZONhBD6j6iKbLL1ziYi8qiJ5VMVCqt9r6vIbhHbVf2AY3FeBJirSp qjyJ5s+Gxr1bdmY+tXbfK/2JVJZvR1S6yM+o4XZYLOwuEUE3KoDv26yl7xVvunbimZ3f weqjxnkC8ZPr+/S9uoUzO2ypNOixM+nUtDNLFiWOqEbdzYgZmV/mKSfFtrdTdeyKnpRH w7aw+0y7xhuWAGRqKx7Ip2jBC2uw1zkCR/1sSuXKpQfRHv90AqfhNfb5as088k41AMey QY6g== X-Gm-Message-State: ACrzQf2+x/VQPIsoTBGmycmp4yYKxglrSCh1zJUkMzPmscrQg0EjY0I1 Z5Cjn+bEjPNA3c3aq4f7M5v18faar3Boa9VcnuSnSwW66NM= X-Google-Smtp-Source: AMsMyM4+sJ1YradFcoc4k6hUtVk8afNvjHHZcEhWTqaTcLZ42ZJGYhCbt5GbOGnpTYfmTPuVwloOwLq3RdRJWKg5XHg= X-Received: by 2002:ab0:6f93:0:b0:3d7:b9af:39d4 with SMTP id f19-20020ab06f93000000b003d7b9af39d4mr93119uav.84.1665791832954; Fri, 14 Oct 2022 16:57:12 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Fri, 14 Oct 2022 18:57:00 -0500 Message-ID: Subject: [PATCH][SMB3 client] minor coverity fix for unitialized MBZ ACL fields To: CIFS Cc: Paulo Alcantara Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org smb3: must initialize two ACL struct fields to zero Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") See attached From 4944fc48ad344d76263b9b4394ce0d474b7f5de1 Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 14 Oct 2022 18:50:20 -0500 Subject: [PATCH] smb3: must initialize two ACL struct fields to zero Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e1162217ad1a..f8f89ff96c5d 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2420,7 +2420,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) unsigned int acelen, acl_size, ace_count; unsigned int owner_offset = 0; unsigned int group_offset = 0; - struct smb3_acl acl; + struct smb3_acl acl = {}; *len = round_up(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); @@ -2493,6 +2493,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclSize = cpu_to_le16(acl_size); acl.AceCount = cpu_to_le16(ace_count); + /* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); -- 2.34.1