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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241229105722.03ada34f@dsl-u17-10>
Date: Sun, 29 Dec 2024 10:57:22 +0000
From: David Laight <david.laight.linux@...il.com>
To: Takashi Iwai <tiwai@...e.de>
Cc: Ethan Carter Edwards <ethan@...ancedwards.com>,
 "wychay@....creative.com" <wychay@....creative.com>,
 "ryan_richards@...ativelabs.com" <ryan_richards@...ativelabs.com>,
 "linux-sound@...r.kernel.org" <linux-sound@...r.kernel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: sound/pci/ctxfi/ctdaio.c: duplicate function removal question

On Sun, 29 Dec 2024 10:10:09 +0100
Takashi Iwai <tiwai@...e.de> wrote:

> On Sun, 29 Dec 2024 10:02:28 +0100,
> David Laight wrote:
> > 
> > On Tue, 24 Dec 2024 23:16:17 +0000
> > Ethan Carter Edwards <ethan@...ancedwards.com> wrote:
> >   
> > > Hello all,
> > > 
> > > First of all, happy holidays. 
> > > 
> > > I was browsing the ctdaio.c code and I noticed a lot of 
> > > duplicate code and functions, specifically:
> > > 
> > > dao_set_{right,left}_input and
> > > dao_clear_{right,left}_input functions.
> > > 
> > > The functions are pretty much identical. They only 
> > > differ in the side (left, right). What was the original
> > > idea in doing this? Wouldn't it make more since to just
> > > have an ENUM (left, right) as an argument that would 
> > > determine the side and just reduce the function to 
> > > dao_set_input and dao_clear_input.  
> > 
> > Hmmm... you'd have a lot of conditionals inside the function.
> > 
> > They also look like a memory leak just waiting to happen.
> > I guess that an earlier implementation used a separate kmalloc()
> > for each imappers[].
> > 
> > Why is imappers[] an array of pointers not an array of the items?
> > Each is just 8 bytes plus a 'list_head' (2 pointers?).  
> 
> AFAIUC, it's a setup of a chained element, so no leak there as of
> now.

Unless someone calls the functions in the wrong order.
And that seems to be outside the control of this code.

	David

> 
> I agree with that the code is unnecessarily complex, though.
> 
> 
> thanks,
> 
> Takashi


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ