From patchwork Sat Jun 19 17:28:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12333087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 414D8C2B9F4 for ; Sat, 19 Jun 2021 17:29:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1244D610CA for ; Sat, 19 Jun 2021 17:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234921AbhFSRbP (ORCPT ); Sat, 19 Jun 2021 13:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234900AbhFSRbO (ORCPT ); Sat, 19 Jun 2021 13:31:14 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2821C061574 for ; Sat, 19 Jun 2021 10:29:03 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id s22so18691421ljg.5 for ; Sat, 19 Jun 2021 10:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=yEarzpgEbdZ22/YTEoU6aldugtTo2/E8eABkHttGMtQ=; b=fnWpw0fA3FJAS5w+jDQEwb1sYR/4pU+fd0sWLMvYy+TV8a2sefcUJhPWfANG64nKJf iwm/ekxPt17m3F9uxJK6J231ZmNML7E+SwRJNKhHhxRNo5+vFRui19g4Cmn8ZjL5fZvP IZXEj4oBBAme0PcOz8LsIKYyFNWZ9u7W7PoVYXUZcbXh5HDA8Md9dlwv2DmbM+s/pkCz PjmwfiEx8KJ06LfoEzESChONkNYbOrxq4CtiIHIu28z9qPqjbfJhKYz1jFDZE3njFh/p TM7hEsAbWQNdA8c8JYBj7evRjcnp5qlc+ripBddJLp4pzijNbrvbwIFbBDsm6lhUqGE9 8kpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=yEarzpgEbdZ22/YTEoU6aldugtTo2/E8eABkHttGMtQ=; b=sQSLoiS8y5JOCDTjYzz2Zua/Y1Bpg40KbagLjf7quyS1eR/gOJ5JLC1GWpBq4NV1pm 13OUtFwPv1IERn0mGOrYYVS67SYEbmpivOA90BKa0/HiH6UpXie7YmUtLLVLEufrdnru c7qJu9yHpjgBCvPf+aPtUAtiH7VGNjfMqLjoFKZzJWy2/Ko8fhX/plQkOZZMxWpkuIBF clfoAqYcBPuAb0Ud0ivT3g6aAIO571+/sPRhird8qGOUQAzffmM8nokRzlkXYsp7uLPK 5It+3HcJRKm+lze7I7IygLli+X9yhTVWKKiv1PXJwrWS37+AK9N+IIi5TpUpox8Jg0yW ujhQ== X-Gm-Message-State: AOAM530KrZq5ZhPY3G1PiMtTuNR8r7d1RRqIfxHC4UFFFLuSsvRTKmjH 1BEwa7TfBmGdj6UTCu7mv/cI2wvsIIjKeEf1xx1qqFpgCpMD4Q== X-Google-Smtp-Source: ABdhPJxL1usFoCqgVeHHvYLwccfFS3ZS9Ps+/bjbSzrEHiHNJEuVnQuy5gKhM6nrg8JhxpoGOkyRHR/7zJhT5gcOT48= X-Received: by 2002:a2e:509:: with SMTP id 9mr14650526ljf.6.1624123740425; Sat, 19 Jun 2021 10:29:00 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sat, 19 Jun 2021 12:28:49 -0500 Message-ID: Subject: [SMB3][PATCH] fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'. To: CIFS , Dan Carpenter , Samuel Cabrero Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org fix uninitialized value for port in witness protocol move Although in practice this can not occur (since IPv4 and IPv6 are the only two cases currently supported), it is cleaner to avoid uninitialized variable warnings. Addresses smatch warning: fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'. Reported-by: kernel test robot Reported-by: Dan Carpenter CC: Samuel Cabrero Signed-off-by: Steve French From 47e6b943fbce607b91d40e090efbdb270e3bf8d1 Mon Sep 17 00:00:00 2001 From: Steve French Date: Sat, 19 Jun 2021 12:22:20 -0500 Subject: [PATCH] smb3: fix uninitialized value for port in witness protocol move Although in practice this can not occur (since IPv4 and IPv6 are the only two cases currently supported), it is cleaner to avoid uninitialized variable warnings. Addresses smatch warning: fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'. Reported-by: kernel test robot Reported-by: Dan Carpenter CC: Samuel Cabrero Signed-off-by: Steve French --- fs/cifs/cifs_swn.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c index d829b8bf833e..93b47818c6c2 100644 --- a/fs/cifs/cifs_swn.c +++ b/fs/cifs/cifs_swn.c @@ -447,15 +447,13 @@ static int cifs_swn_store_swn_addr(const struct sockaddr_storage *new, const struct sockaddr_storage *old, struct sockaddr_storage *dst) { - __be16 port; + __be16 port = cpu_to_be16(CIFS_PORT); if (old->ss_family == AF_INET) { struct sockaddr_in *ipv4 = (struct sockaddr_in *)old; port = ipv4->sin_port; - } - - if (old->ss_family == AF_INET6) { + } else if (old->ss_family == AF_INET6) { struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)old; port = ipv6->sin6_port; @@ -465,9 +463,7 @@ static int cifs_swn_store_swn_addr(const struct sockaddr_storage *new, struct sockaddr_in *ipv4 = (struct sockaddr_in *)new; ipv4->sin_port = port; - } - - if (new->ss_family == AF_INET6) { + } else if (new->ss_family == AF_INET6) { struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)new; ipv6->sin6_port = port; -- 2.30.2