From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Samuel Cabrero <scabrero@suse.de>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org,
Steve French <stfrench@microsoft.com>,
Aurelien Aptel <aaptel@suse.com>
Subject: fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'.
Date: Sat, 19 Jun 2021 16:46:13 +0300 [thread overview]
Message-ID: <202106192055.9FuqF8dj-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9ed13a17e38e0537e24d9b507645002bf8d0201f
commit: 121d947d4fe15bcec90bcfc1249ee9b739cb9258 cifs: Handle witness client move notification
config: h8300-randconfig-m031-20210618 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'.
vim +/port +468 fs/cifs/cifs_swn.c
121d947d4fe15b Samuel Cabrero 2020-11-30 447 static int cifs_swn_store_swn_addr(const struct sockaddr_storage *new,
121d947d4fe15b Samuel Cabrero 2020-11-30 448 const struct sockaddr_storage *old,
121d947d4fe15b Samuel Cabrero 2020-11-30 449 struct sockaddr_storage *dst)
121d947d4fe15b Samuel Cabrero 2020-11-30 450 {
121d947d4fe15b Samuel Cabrero 2020-11-30 451 __be16 port;
121d947d4fe15b Samuel Cabrero 2020-11-30 452
121d947d4fe15b Samuel Cabrero 2020-11-30 453 if (old->ss_family == AF_INET) {
121d947d4fe15b Samuel Cabrero 2020-11-30 454 struct sockaddr_in *ipv4 = (struct sockaddr_in *)old;
121d947d4fe15b Samuel Cabrero 2020-11-30 455
121d947d4fe15b Samuel Cabrero 2020-11-30 456 port = ipv4->sin_port;
121d947d4fe15b Samuel Cabrero 2020-11-30 457 }
121d947d4fe15b Samuel Cabrero 2020-11-30 458
121d947d4fe15b Samuel Cabrero 2020-11-30 459 if (old->ss_family == AF_INET6) {
121d947d4fe15b Samuel Cabrero 2020-11-30 460 struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)old;
121d947d4fe15b Samuel Cabrero 2020-11-30 461
121d947d4fe15b Samuel Cabrero 2020-11-30 462 port = ipv6->sin6_port;
121d947d4fe15b Samuel Cabrero 2020-11-30 463 }
121d947d4fe15b Samuel Cabrero 2020-11-30 464
121d947d4fe15b Samuel Cabrero 2020-11-30 465 if (new->ss_family == AF_INET) {
121d947d4fe15b Samuel Cabrero 2020-11-30 466 struct sockaddr_in *ipv4 = (struct sockaddr_in *)new;
121d947d4fe15b Samuel Cabrero 2020-11-30 467
121d947d4fe15b Samuel Cabrero 2020-11-30 @468 ipv4->sin_port = port;
Apparently Smatch is not smart enough to know that AF_INET and AF_INET6
are the only possible values for old->ss_family. I hope that eventually
we will be able to enable GCC's uninitialized variable checking and GCC
is certainly not able to figure this out either.
121d947d4fe15b Samuel Cabrero 2020-11-30 469 }
121d947d4fe15b Samuel Cabrero 2020-11-30 470
121d947d4fe15b Samuel Cabrero 2020-11-30 471 if (new->ss_family == AF_INET6) {
121d947d4fe15b Samuel Cabrero 2020-11-30 472 struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)new;
121d947d4fe15b Samuel Cabrero 2020-11-30 473
121d947d4fe15b Samuel Cabrero 2020-11-30 474 ipv6->sin6_port = port;
121d947d4fe15b Samuel Cabrero 2020-11-30 475 }
121d947d4fe15b Samuel Cabrero 2020-11-30 476
121d947d4fe15b Samuel Cabrero 2020-11-30 477 *dst = *new;
121d947d4fe15b Samuel Cabrero 2020-11-30 478
121d947d4fe15b Samuel Cabrero 2020-11-30 479 return 0;
121d947d4fe15b Samuel Cabrero 2020-11-30 480 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2021-06-19 13:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202106192055.9FuqF8dj-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=aaptel@suse.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=scabrero@suse.de \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox