public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port'.
@ 2021-06-19 13:46 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-06-19 13:46 UTC (permalink / raw)
  To: kbuild, Samuel Cabrero
  Cc: lkp, kbuild-all, linux-kernel, Steve French, Aurelien Aptel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-19 13:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-19 13:46 fs/cifs/cifs_swn.c:468 cifs_swn_store_swn_addr() error: uninitialized symbol 'port' Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox