Content-Type: multipart/mixed; boundary="===============0994890044092917313==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v2 07/35] brcmfmac: pcie: Read Apple OTP information Date: Thu, 06 Jan 2022 07:38:46 +0800 Message-ID: <202201060758.hCG39IaN-lkp@intel.com> In-Reply-To: <20220104072658.69756-8-marcan@marcan.st> List-Id: --===============0994890044092917313== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Hector, I love your patch! Perhaps something to improve: [auto build test WARNING on kvalo-wireless-drivers-next/master] [also build test WARNING on kvalo-wireless-drivers/master rafael-pm/linux-n= ext net-next/master net/master robh/for-next linus/master v5.16-rc8 next-20= 220105] [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] url: https://github.com/0day-ci/linux/commits/Hector-Martin/brcmfmac-Sup= port-Apple-T2-and-M1-platforms/20220104-153413 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-driv= ers-next.git master config: x86_64-randconfig-r024-20220105 (https://download.01.org/0day-ci/ar= chive/20220106/202201060758.hCG39IaN-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e3= 0ed3acad794dd0aec400e617daffc6cc3d) reproduce (this is a W=3D1 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/0day-ci/linux/commit/e81f1e021ca0e590a60310212= 5ba1ad03dfff42c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Hector-Martin/brcmfmac-Support-App= le-T2-and-M1-platforms/20220104-153413 git checkout e81f1e021ca0e590a603102125ba1ad03dfff42c # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Dx86_64 SHELL=3D/bin/bash drivers/net/wireless/broadc= om/brcm80211/brcmfmac/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:1863:20: warning= : address of array 'devinfo->otp.version' will always evaluate to 'true' [-= Wpointer-bool-conversion] !devinfo->otp.version) ~~~~~~~~~~~~~~^~~~~~~ >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:1862:20: warning= : address of array 'devinfo->otp.vendor' will always evaluate to 'true' [-W= pointer-bool-conversion] !devinfo->otp.vendor || ~~~~~~~~~~~~~~^~~~~~ >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:1861:20: warning= : address of array 'devinfo->otp.module' will always evaluate to 'true' [-W= pointer-bool-conversion] if (!devinfo->otp.module || ~~~~~~~~~~~~~~^~~~~~ 3 warnings generated. vim +1863 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c 1785 = 1786 static int 1787 brcmf_pcie_parse_otp_sys_vendor(struct brcmf_pciedev_info *devinfo, 1788 u8 *data, size_t size) 1789 { 1790 int idx =3D 4; 1791 const char *chip_params; 1792 const char *board_params; 1793 const char *p; 1794 = 1795 /* 4-byte header and two empty strings */ 1796 if (size < 6) 1797 return -EINVAL; 1798 = 1799 if (get_unaligned_le32(data) !=3D BRCMF_OTP_VENDOR_HDR) 1800 return -EINVAL; 1801 = 1802 chip_params =3D &data[idx]; 1803 = 1804 /* Skip first string, including terminator */ 1805 idx +=3D strnlen(chip_params, size - idx) + 1; 1806 if (idx >=3D size) 1807 return -EINVAL; 1808 = 1809 board_params =3D &data[idx]; 1810 = 1811 /* Skip to terminator of second string */ 1812 idx +=3D strnlen(board_params, size - idx); 1813 if (idx >=3D size) 1814 return -EINVAL; 1815 = 1816 /* At this point both strings are guaranteed NUL-terminated */ 1817 brcmf_dbg(PCIE, "OTP: chip_params=3D'%s' board_params=3D'%s'\n", 1818 chip_params, board_params); 1819 = 1820 p =3D board_params; 1821 while (*p) { 1822 char tag =3D *p++; 1823 const char *end; 1824 size_t len; 1825 = 1826 if (tag =3D=3D ' ') /* Skip extra spaces */ 1827 continue; 1828 = 1829 if (*p++ !=3D '=3D') /* implicit NUL check */ 1830 return -EINVAL; 1831 = 1832 /* *p might be NUL here, if so end =3D=3D p and len =3D=3D 0 */ 1833 end =3D strchrnul(p, ' '); 1834 len =3D end - p; 1835 = 1836 /* leave 1 byte for NUL in destination string */ 1837 if (len > (BRCMF_OTP_MAX_PARAM_LEN - 1)) 1838 return -EINVAL; 1839 = 1840 /* Copy len characters plus a NUL terminator */ 1841 switch (tag) { 1842 case 'M': 1843 strscpy(devinfo->otp.module, p, len + 1); 1844 break; 1845 case 'V': 1846 strscpy(devinfo->otp.vendor, p, len + 1); 1847 break; 1848 case 'm': 1849 strscpy(devinfo->otp.version, p, len + 1); 1850 break; 1851 } 1852 = 1853 /* Skip to space separator or NUL */ 1854 p =3D end; 1855 } 1856 = 1857 brcmf_dbg(PCIE, "OTP: module=3D%s vendor=3D%s version=3D%s\n", 1858 devinfo->otp.module, devinfo->otp.vendor, 1859 devinfo->otp.version); 1860 = > 1861 if (!devinfo->otp.module || > 1862 !devinfo->otp.vendor || > 1863 !devinfo->otp.version) 1864 return -EINVAL; 1865 = 1866 devinfo->otp.valid =3D true; 1867 return 0; 1868 } 1869 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0994890044092917313==--