lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 20 May 2023 17:04:25 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stanley Chang <stanley_chang@...ltek.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        Stanley Chang <stanley_chang@...ltek.com>,
        Vinod Koul <vkoul@...nel.org>,
        Kishon Vijay Abraham I <kishon@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Ray Chi <raychi@...gle.com>,
        Bagas Sanjaya <bagasdotme@...il.com>,
        Eugeniu Rosca <erosca@...adit-jv.com>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>,
        Matthias Kaehlcke <mka@...omium.org>,
        Flavio Suligoi <f.suligoi@...m.it>,
        Mathias Nyman <mathias.nyman@...ux.intel.com>,
        Bhuvanesh Surachari <Bhuvanesh_Surachari@...tor.com>,
        Arnd Bergmann <arnd@...db.de>,
        Paul Cercueil <paul@...pouillou.net>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-phy@...ts.infradead.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH v1 2/3] usb: phy: Add driver for the Realtek SoC USB
 2.0/3.0 PHY

Hi Stanley,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus robh/for-next linus/master v6.4-rc2 next-20230519]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Stanley-Chang/usb-phy-Add-driver-for-the-Realtek-SoC-USB-2-0-3-0-PHY/20230519-130108
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20230519045825.28369-2-stanley_chang%40realtek.com
patch subject: [PATCH v1 2/3] usb: phy: Add driver for the Realtek SoC USB 2.0/3.0 PHY
config: i386-allyesconfig
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/e5d8b867188b162bc49cc68373b1a25a179c01b3
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Stanley-Chang/usb-phy-Add-driver-for-the-Realtek-SoC-USB-2-0-3-0-PHY/20230519-130108
        git checkout e5d8b867188b162bc49cc68373b1a25a179c01b3
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/usb/phy/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305201608.MBqXmFKF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/usb/phy/phy-rtk-usb2.c:1049:11: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (strcmp("page2", dir_name) == 0)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1053:6: note: uninitialized use occurs here
           if (ret < 0)
               ^~~
   drivers/usb/phy/phy-rtk-usb2.c:1049:7: note: remove the 'if' if its condition is always true
           else if (strcmp("page2", dir_name) == 0)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1023:9: note: initialize the variable 'ret' to silence this warning
           int ret, index;
                  ^
                   = 0
>> drivers/usb/phy/phy-rtk-usb2.c:1026:18: warning: variable 'phy_data' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1036:7: note: uninitialized use occurs here
           if (!phy_data) {
                ^~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1026:18: note: remove the condition if it is always true
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1024:27: note: initialize the variable 'phy_data' to silence this warning
           struct phy_data *phy_data;
                                    ^
                                     = NULL
>> drivers/usb/phy/phy-rtk-usb2.c:1088:18: warning: variable 'regAddr' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1099:7: note: uninitialized use occurs here
           if (!regAddr) {
                ^~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1088:18: note: remove the condition if it is always true
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb2.c:1078:26: note: initialize the variable 'regAddr' to silence this warning
           struct reg_addr *regAddr;
                                   ^
                                    = NULL
   3 warnings generated.
--
>> drivers/usb/phy/phy-rtk-usb3.c:532:18: warning: variable 'phy_data' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:542:7: note: uninitialized use occurs here
           if (!phy_data) {
                ^~~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:532:18: note: remove the condition if it is always true
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:530:27: note: initialize the variable 'phy_data' to silence this warning
           struct phy_data *phy_data;
                                    ^
                                     = NULL
>> drivers/usb/phy/phy-rtk-usb3.c:583:18: warning: variable 'regAddr' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:594:7: note: uninitialized use occurs here
           if (!regAddr) {
                ^~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:583:18: note: remove the condition if it is always true
           for (index = 0; index < rtk_phy->phyN; index++) {
                           ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/phy/phy-rtk-usb3.c:573:26: note: initialize the variable 'regAddr' to silence this warning
           struct reg_addr *regAddr;
                                   ^
                                    = NULL
   2 warnings generated.


vim +1049 drivers/usb/phy/phy-rtk-usb2.c

  1013	
  1014	static int rtk_usb2_set_parameter_show(struct seq_file *s, void *unused)
  1015	{
  1016		struct rtk_usb_phy *rtk_phy = s->private;
  1017		const struct file *file = s->file;
  1018		const char *file_name = file_dentry(file)->d_iname;
  1019		struct dentry *p_dentry = file_dentry(file)->d_parent;
  1020		const char *dir_name = p_dentry->d_iname;
  1021		struct dentry *pp_dentry = p_dentry->d_parent;
  1022		const char *phy_dir_name = pp_dentry->d_iname;
  1023		int ret, index;
  1024		struct phy_data *phy_data;
  1025	
> 1026		for (index = 0; index < rtk_phy->phyN; index++) {
  1027			size_t sz = 30;
  1028			char name[30] = {0};
  1029	
  1030			snprintf(name, sz, "phy%d", index);
  1031			if (strncmp(name, phy_dir_name, strlen(name)) == 0) {
  1032				phy_data = &((struct phy_data *)rtk_phy->phy_data)[index];
  1033				break;
  1034			}
  1035		}
  1036		if (!phy_data) {
  1037			dev_err(rtk_phy->dev,
  1038					    "%s: No phy_data for %s/%s/%s\n",
  1039					    __func__, phy_dir_name, dir_name, file_name);
  1040			return -EINVAL;
  1041		}
  1042	
  1043		if (strcmp("page0", dir_name) == 0)
  1044			ret = __get_parameter_at_page(s, rtk_phy, phy_data->page0,
  1045				    dir_name, file_name);
  1046		else if (strcmp("page1", dir_name) == 0)
  1047			ret = __get_parameter_at_page(s, rtk_phy, phy_data->page1,
  1048				    dir_name, file_name);
> 1049		else if (strcmp("page2", dir_name) == 0)
  1050			ret = __get_parameter_at_page(s, rtk_phy, phy_data->page2,
  1051				    dir_name, file_name);
  1052	
  1053		if (ret < 0)
  1054			return ret;
  1055	
  1056		seq_puts(s, "Set phy parameter by following command\n");
  1057		seq_printf(s, "echo \"value\" > %s/%s/%s\n",
  1058			    phy_dir_name, dir_name, file_name);
  1059	
  1060		return 0;
  1061	}
  1062	
  1063	static int rtk_usb2_set_parameter_open(struct inode *inode, struct file *file)
  1064	{
  1065		return single_open(file, rtk_usb2_set_parameter_show, inode->i_private);
  1066	}
  1067	
  1068	static ssize_t rtk_usb2_set_parameter_write(struct file *file,
  1069			const char __user *ubuf, size_t count, loff_t *ppos)
  1070	{
  1071		const char *file_name = file_dentry(file)->d_iname;
  1072		struct dentry *p_dentry = file_dentry(file)->d_parent;
  1073		const char *dir_name = p_dentry->d_iname;
  1074		struct dentry *pp_dentry = p_dentry->d_parent;
  1075		const char *phy_dir_name = pp_dentry->d_iname;
  1076		struct seq_file		*s = file->private_data;
  1077		struct rtk_usb_phy		*rtk_phy = s->private;
  1078		struct reg_addr *regAddr;
  1079		struct phy_data *phy_data;
  1080		int ret = 0;
  1081		char buffer[40] = {0};
  1082		int index;
  1083	
  1084		if (copy_from_user(&buffer, ubuf,
  1085			    min_t(size_t, sizeof(buffer) - 1, count)))
  1086			return -EFAULT;
  1087	
> 1088		for (index = 0; index < rtk_phy->phyN; index++) {
  1089			size_t sz = 30;
  1090			char name[30] = {0};
  1091	
  1092			snprintf(name, sz, "phy%d", index);
  1093			if (strncmp(name, phy_dir_name, strlen(name)) == 0) {
  1094				regAddr = &((struct reg_addr *)rtk_phy->reg_addr)[index];
  1095				phy_data = &((struct phy_data *)rtk_phy->phy_data)[index];
  1096				break;
  1097			}
  1098		}
  1099		if (!regAddr) {
  1100			dev_err(rtk_phy->dev,
  1101					    "%s: No regAddr for %s/%s/%s\n",
  1102					    __func__, phy_dir_name, dir_name, file_name);
  1103			return -EINVAL;
  1104		}
  1105		if (!phy_data) {
  1106			dev_err(rtk_phy->dev,
  1107					    "%s: No phy_data for %s/%s/%s\n",
  1108					    __func__, phy_dir_name, dir_name, file_name);
  1109			return -EINVAL;
  1110		}
  1111	
  1112		if (strcmp("page0", dir_name) == 0) {
  1113			rtk_usb_phy_set_page(regAddr, 0);
  1114			ret = __set_parameter_at_page(rtk_phy, regAddr, phy_data,
  1115				    phy_data->page0, dir_name, file_name, buffer);
  1116		} else if (strcmp("page1", dir_name) == 0) {
  1117			rtk_usb_phy_set_page(regAddr, 1);
  1118			ret = __set_parameter_at_page(rtk_phy, regAddr, phy_data,
  1119				    phy_data->page1, dir_name, file_name, buffer);
  1120		} else if (strcmp("page2", dir_name) == 0) {
  1121			rtk_usb_phy_set_page(regAddr, 2);
  1122			ret = __set_parameter_at_page(rtk_phy, regAddr, phy_data,
  1123				    phy_data->page2, dir_name, file_name, buffer);
  1124		}
  1125		if (ret < 0)
  1126			return ret;
  1127	
  1128		return count;
  1129	}
  1130	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

View attachment "config" of type "text/plain" (287162 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ