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] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2023 08:34:02 -0800
From: Yury Norov <yury.norov@...il.com>
To: Souradeep Chakrabarti <schakrabarti@...ux.microsoft.com>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
	decui@...rosoft.com, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, longli@...rosoft.com,
	leon@...nel.org, cai.huoqing@...ux.dev, ssengar@...ux.microsoft.com,
	vkuznets@...hat.com, tglx@...utronix.de,
	linux-hyperv@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
	schakrabarti@...rosoft.com, paulros@...rosoft.com
Subject: Re: [PATCH V5 net-next] net: mana: Assigning IRQ affinity on HT cores

> > > > > +	rcu_read_lock();
> > > > > +	for_each_numa_hop_mask(next, next_node) {
> > > > > +		cpumask_andnot(curr, next, prev);
> > > > > +		for (w = cpumask_weight(curr), cnt = 0; cnt < w; ) {
> > > > > +			cpumask_copy(cpus, curr);
> > > > > +			for_each_cpu(cpu, cpus) {
> > > > > +				irq_set_affinity_and_hint(irqs[i], topology_sibling_cpumask(cpu));
> > > > > +				if (++i == nvec)
> > > > > +					goto done;
> > > > 
> > > > Think what if you're passed with irq_setup(NULL, 0, 0).
> > > > That's why I suggested to place this check at the beginning.
> > > > 
> > > irq_setup() is a helper function for mana_gd_setup_irqs(), which already takes
> > > care of no NULL pointer for irqs, and 0 number of interrupts can not be passed.
> > > 
> > > nvec = pci_alloc_irq_vectors(pdev, 2, max_irqs, PCI_IRQ_MSIX);
> > > if (nvec < 0)
> > > 	return nvec;
> > 
> > I know that. But still it's a bug. The common convention is that if a
> > 0-length array is passed to a function, it should not dereference the
> > pointer.
> > 
> I will add one if check in the begining of irq_setup() to verify the pointer
> and the nvec number.

Yes you can, but what for? This is an error anyways, and you don't
care about early return. So instead of adding and bearing extra logic,
I'd just swap 2 lines of existing code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ