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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202006252155.MCofklkI%lkp@intel.com>
Date:   Thu, 25 Jun 2020 22:17:12 +0800
From:   kernel test robot <lkp@...el.com>
To:     Tiezhu Yang <yangtiezhu@...ngson.cn>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>,
        Marc Zyngier <maz@...nel.org>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
        Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH v2 13/14] irqchip/s3c24xx: Fix potential resource leaks

Hi Tiezhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc2 next-20200624]
[cannot apply to tip/irq/core omap/for-next xlnx/master arm-jcooper/irqchip/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Tiezhu-Yang/irqchip-Fix-potential-resource-leaks/20200624-144653
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3e08a95294a4fb3702bb3d35ed08028433c37fe6
config: arm-randconfig-r035-20200624 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 1d4c87335d5236ea1f35937e1014980ba961ae34)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   In file included from arch/arm/include/asm/io.h:438:
   include/asm-generic/io.h:676:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           insl(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:206:34: note: expanded from macro 'insl'
   #define insl(p,d,l)     __raw_readsl(__ioaddr(p),d,l)
                                        ^~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:202:65: note: expanded from macro '__ioaddr'
   #define __ioaddr(p)     (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
                                                                       ^~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:194:86: note: expanded from macro '__ioaddrc'
   #define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
                                                                      ~~~~~~~~~~~~~~~~~ ^
   In file included from drivers/irqchip/irq-s3c24xx.c:13:
   In file included from include/linux/io.h:13:
   In file included from arch/arm/include/asm/io.h:438:
   include/asm-generic/io.h:685:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsb(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:208:36: note: expanded from macro 'outsb'
   #define outsb(p,d,l)    __raw_writesb(__ioaddr(p),d,l)
                                         ^~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:202:65: note: expanded from macro '__ioaddr'
   #define __ioaddr(p)     (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
                                                                       ^~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:194:86: note: expanded from macro '__ioaddrc'
   #define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
                                                                      ~~~~~~~~~~~~~~~~~ ^
   In file included from drivers/irqchip/irq-s3c24xx.c:13:
   In file included from include/linux/io.h:13:
   In file included from arch/arm/include/asm/io.h:438:
   include/asm-generic/io.h:694:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsw(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:209:36: note: expanded from macro 'outsw'
   #define outsw(p,d,l)    __raw_writesw(__ioaddr(p),d,l)
                                         ^~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:202:65: note: expanded from macro '__ioaddr'
   #define __ioaddr(p)     (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
                                                                       ^~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:194:86: note: expanded from macro '__ioaddrc'
   #define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
                                                                      ~~~~~~~~~~~~~~~~~ ^
   In file included from drivers/irqchip/irq-s3c24xx.c:13:
   In file included from include/linux/io.h:13:
   In file included from arch/arm/include/asm/io.h:438:
   include/asm-generic/io.h:703:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsl(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:210:36: note: expanded from macro 'outsl'
   #define outsl(p,d,l)    __raw_writesl(__ioaddr(p),d,l)
                                         ^~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:202:65: note: expanded from macro '__ioaddr'
   #define __ioaddr(p)     (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
                                                                       ^~~~~~~~~~~~
   arch/arm/mach-s3c24xx/include/mach/io.h:194:86: note: expanded from macro '__ioaddrc'
   #define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
                                                                      ~~~~~~~~~~~~~~~~~ ^
   drivers/irqchip/irq-s3c24xx.c:359:39: warning: no previous prototype for function 's3c24xx_handle_irq' [-Wmissing-prototypes]
   asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
                                         ^
   drivers/irqchip/irq-s3c24xx.c:359:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
              ^
              static 
   drivers/irqchip/irq-s3c24xx.c:676:13: warning: no previous prototype for function 's3c2410_init_irq' [-Wmissing-prototypes]
   void __init s3c2410_init_irq(void)
               ^
   drivers/irqchip/irq-s3c24xx.c:676:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init s3c2410_init_irq(void)
   ^
   static 
   drivers/irqchip/irq-s3c24xx.c:776:13: warning: no previous prototype for function 's3c2412_init_irq' [-Wmissing-prototypes]
   void __init s3c2412_init_irq(void)
               ^
   drivers/irqchip/irq-s3c24xx.c:776:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init s3c2412_init_irq(void)
   ^
   static 
   drivers/irqchip/irq-s3c24xx.c:875:13: warning: no previous prototype for function 's3c2416_init_irq' [-Wmissing-prototypes]
   void __init s3c2416_init_irq(void)
               ^
   drivers/irqchip/irq-s3c24xx.c:875:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init s3c2416_init_irq(void)
   ^
   static 
   drivers/irqchip/irq-s3c24xx.c:954:13: warning: no previous prototype for function 's3c2440_init_irq' [-Wmissing-prototypes]
   void __init s3c2440_init_irq(void)
               ^
   drivers/irqchip/irq-s3c24xx.c:954:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init s3c2440_init_irq(void)
   ^
   static 
   drivers/irqchip/irq-s3c24xx.c:1117:13: warning: no previous prototype for function 's3c2443_init_irq' [-Wmissing-prototypes]
   void __init s3c2443_init_irq(void)
               ^
   drivers/irqchip/irq-s3c24xx.c:1117:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init s3c2443_init_irq(void)
   ^
   static 
>> drivers/irqchip/irq-s3c24xx.c:1242:3: error: use of undeclared identifier 'ret'
                   ret = -EINVAL;
                   ^
   drivers/irqchip/irq-s3c24xx.c:1253:4: error: use of undeclared identifier 'ret'
                           ret = -ENOMEM;
                           ^
   drivers/irqchip/irq-s3c24xx.c:1261:4: error: use of undeclared identifier 'ret'
                           ret = -ENOMEM;
                           ^
   drivers/irqchip/irq-s3c24xx.c:1311:12: warning: no previous prototype for function 's3c2410_init_intc_of' [-Wmissing-prototypes]
   int __init s3c2410_init_intc_of(struct device_node *np,
              ^
   drivers/irqchip/irq-s3c24xx.c:1311:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int __init s3c2410_init_intc_of(struct device_node *np,
   ^
   static 
   drivers/irqchip/irq-s3c24xx.c:1333:12: warning: no previous prototype for function 's3c2416_init_intc_of' [-Wmissing-prototypes]
   int __init s3c2416_init_intc_of(struct device_node *np,
              ^
   drivers/irqchip/irq-s3c24xx.c:1333:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int __init s3c2416_init_intc_of(struct device_node *np,
   ^
   static 
   14 warnings and 3 errors generated.

vim +/ret +1242 drivers/irqchip/irq-s3c24xx.c

  1116	
> 1117	void __init s3c2443_init_irq(void)
  1118	{
  1119		pr_info("S3C2443: IRQ Support\n");
  1120	
  1121	#ifdef CONFIG_FIQ
  1122		init_FIQ(FIQ_START);
  1123	#endif
  1124	
  1125		s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL,
  1126						0x4a000000);
  1127		if (IS_ERR(s3c_intc[0])) {
  1128			pr_err("irq: could not create main interrupt controller\n");
  1129			return;
  1130		}
  1131	
  1132		s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
  1133		s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0],
  1134						s3c_intc[0], 0x4a000018);
  1135	}
  1136	#endif
  1137	
  1138	#ifdef CONFIG_OF
  1139	static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq,
  1140								irq_hw_number_t hw)
  1141	{
  1142		unsigned int ctrl_num = hw / 32;
  1143		unsigned int intc_hw = hw % 32;
  1144		struct s3c_irq_intc *intc = s3c_intc[ctrl_num];
  1145		struct s3c_irq_intc *parent_intc = intc->parent;
  1146		struct s3c_irq_data *irq_data = &intc->irqs[intc_hw];
  1147	
  1148		/* attach controller pointer to irq_data */
  1149		irq_data->intc = intc;
  1150		irq_data->offset = intc_hw;
  1151	
  1152		if (!parent_intc)
  1153			irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq);
  1154		else
  1155			irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
  1156						 handle_edge_irq);
  1157	
  1158		irq_set_chip_data(virq, irq_data);
  1159	
  1160		return 0;
  1161	}
  1162	
  1163	/* Translate our of irq notation
  1164	 * format: <ctrl_num ctrl_irq parent_irq type>
  1165	 */
  1166	static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n,
  1167				const u32 *intspec, unsigned int intsize,
  1168				irq_hw_number_t *out_hwirq, unsigned int *out_type)
  1169	{
  1170		struct s3c_irq_intc *intc;
  1171		struct s3c_irq_intc *parent_intc;
  1172		struct s3c_irq_data *irq_data;
  1173		struct s3c_irq_data *parent_irq_data;
  1174		int irqno;
  1175	
  1176		if (WARN_ON(intsize < 4))
  1177			return -EINVAL;
  1178	
  1179		if (intspec[0] > 2 || !s3c_intc[intspec[0]]) {
  1180			pr_err("controller number %d invalid\n", intspec[0]);
  1181			return -EINVAL;
  1182		}
  1183		intc = s3c_intc[intspec[0]];
  1184	
  1185		*out_hwirq = intspec[0] * 32 + intspec[2];
  1186		*out_type = intspec[3] & IRQ_TYPE_SENSE_MASK;
  1187	
  1188		parent_intc = intc->parent;
  1189		if (parent_intc) {
  1190			irq_data = &intc->irqs[intspec[2]];
  1191			irq_data->parent_irq = intspec[1];
  1192			parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
  1193			parent_irq_data->sub_intc = intc;
  1194			parent_irq_data->sub_bits |= (1UL << intspec[2]);
  1195	
  1196			/* parent_intc is always s3c_intc[0], so no offset */
  1197			irqno = irq_create_mapping(parent_intc->domain, intspec[1]);
  1198			if (irqno < 0) {
  1199				pr_err("irq: could not map parent interrupt\n");
  1200				return irqno;
  1201			}
  1202	
  1203			irq_set_chained_handler(irqno, s3c_irq_demux);
  1204		}
  1205	
  1206		return 0;
  1207	}
  1208	
  1209	static const struct irq_domain_ops s3c24xx_irq_ops_of = {
  1210		.map = s3c24xx_irq_map_of,
  1211		.xlate = s3c24xx_irq_xlate_of,
  1212	};
  1213	
  1214	struct s3c24xx_irq_of_ctrl {
  1215		char			*name;
  1216		unsigned long		offset;
  1217		struct s3c_irq_intc	**handle;
  1218		struct s3c_irq_intc	**parent;
  1219		struct irq_domain_ops	*ops;
  1220	};
  1221	
  1222	static int __init s3c_init_intc_of(struct device_node *np,
  1223				struct device_node *interrupt_parent,
  1224				struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl)
  1225	{
  1226		struct s3c_irq_intc *intc;
  1227		struct s3c24xx_irq_of_ctrl *ctrl;
  1228		struct irq_domain *domain;
  1229		void __iomem *reg_base;
  1230		int i;
  1231	
  1232		reg_base = of_iomap(np, 0);
  1233		if (!reg_base) {
  1234			pr_err("irq-s3c24xx: could not map irq registers\n");
  1235			return -EINVAL;
  1236		}
  1237	
  1238		domain = irq_domain_add_linear(np, num_ctrl * 32,
  1239							     &s3c24xx_irq_ops_of, NULL);
  1240		if (!domain) {
  1241			pr_err("irq: could not create irq-domain\n");
> 1242			ret = -EINVAL;
  1243			goto out_iounmap;
  1244		}
  1245	
  1246		for (i = 0; i < num_ctrl; i++) {
  1247			ctrl = &s3c_ctrl[i];
  1248	
  1249			pr_debug("irq: found controller %s\n", ctrl->name);
  1250	
  1251			intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
  1252			if (!intc) {
  1253				ret = -ENOMEM;
  1254				goto out_domain_remove;
  1255			}
  1256	
  1257			intc->domain = domain;
  1258			intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
  1259					     GFP_KERNEL);
  1260			if (!intc->irqs) {
  1261				ret = -ENOMEM;
  1262				goto out_free;
  1263			}
  1264	
  1265			if (ctrl->parent) {
  1266				intc->reg_pending = reg_base + ctrl->offset;
  1267				intc->reg_mask = reg_base + ctrl->offset + 0x4;
  1268	
  1269				if (*(ctrl->parent)) {
  1270					intc->parent = *(ctrl->parent);
  1271				} else {
  1272					pr_warn("irq: parent of %s missing\n",
  1273						ctrl->name);
  1274					kfree(intc->irqs);
  1275					kfree(intc);
  1276					continue;
  1277				}
  1278			} else {
  1279				intc->reg_pending = reg_base + ctrl->offset;
  1280				intc->reg_mask = reg_base + ctrl->offset + 0x08;
  1281				intc->reg_intpnd = reg_base + ctrl->offset + 0x10;
  1282			}
  1283	
  1284			s3c24xx_clear_intc(intc);
  1285			s3c_intc[i] = intc;
  1286		}
  1287	
  1288		set_handle_irq(s3c24xx_handle_irq);
  1289	
  1290		return 0;
  1291	
  1292	out_free:
  1293		kfree(intc);
  1294	out_domain_remove:
  1295		irq_domain_remove(domain);
  1296	out_iounmap:
  1297		iounmap(reg_base);
  1298	}
  1299	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (32189 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ