public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* small 5575 PCI ATM fix
@ 2002-06-18 13:35 Petter
  2002-06-18 13:58 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Petter @ 2002-06-18 13:35 UTC (permalink / raw)
  To: linux-kernel


I was grepping through some code, and noticed that the return value
of a kmalloc in iphase.c was not checked.
A patch was sendt to the author, but this was the reply I got:

"Peter Wang is no longer a member of the Interphase team.  Interphase
does support the 5575 PCI ATM adapter with Linux, but for driver enhancements
and fixes, we require a current software warranty contract.  If you
could send me the serial number and / or the MAC address of your adapter, I
can verify your warranty status and have the latest driver sent to you."

I do not care about their driver since I do not have an ATM card, but
the current driver should anyhow be fixed.

Please apply the patch below.

Regards

Petter Wahlman


--- linux-2.4.19-pre10/drivers/atm/iphase.c     Mon Feb 25 20:37:57 2002
+++ linux-2.4.19-pre10-pw/drivers/atm/iphase.c  Tue Jun 18 10:47:02 2002
@@ -2002,6 +2002,10 @@
         }
         iadev->desc_tbl = kmalloc(iadev->num_tx_desc *
                                    sizeof(struct desc_tbl_t),
GFP_KERNEL);
+       if (!iadev->desc_tbl) {
+            printk(KERN_ERR DEV_LABEL " couldn't get mem\n");
+            return -EAGAIN;
+        }

        /* Communication Queues base address */
         i = TX_COMP_Q * iadev->memSize;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: small 5575 PCI ATM fix
  2002-06-18 13:35 small 5575 PCI ATM fix Petter
@ 2002-06-18 13:58 ` Dave Jones
  2002-06-18 14:12   ` Petter
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2002-06-18 13:58 UTC (permalink / raw)
  To: Petter; +Cc: linux-kernel

On Tue, Jun 18, 2002 at 03:35:27PM +0200, Petter wrote:
 > 
 > I was grepping through some code, and noticed that the return value
 > of a kmalloc in iphase.c was not checked.
 > A patch was sendt to the author, but this was the reply I got:
 > 
 > "Peter Wang is no longer a member of the Interphase team.  Interphase
 > does support the 5575 PCI ATM adapter with Linux, but for driver enhancements
 > and fixes, we require a current software warranty contract.  If you
 > could send me the serial number and / or the MAC address of your adapter, I
 > can verify your warranty status and have the latest driver sent to you."

rofl. 8-)

 > I do not care about their driver since I do not have an ATM card, but
 > the current driver should anyhow be fixed.

Error handling in that driver seems to be 'creative' at best.
No releasing of already allocated resources, just returning -EAGAIN
everywhere, and no checking for already allocated resources.

Someone with too much time on their hands[1] could probably clean this
up to free allocated resources on failure and return -ENOMEM on
allocation failures.

        Dave

[1] or a 'software warranty contract'.

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: small 5575 PCI ATM fix
  2002-06-18 13:58 ` Dave Jones
@ 2002-06-18 14:12   ` Petter
  0 siblings, 0 replies; 3+ messages in thread
From: Petter @ 2002-06-18 14:12 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel

On Tue, Jun 18, 2002 at 03:58:37PM +0200, Dave Jones wrote:
> On Tue, Jun 18, 2002 at 03:35:27PM +0200, Petter wrote:
> Error handling in that driver seems to be 'creative' at best.

I agree.

> No releasing of already allocated resources, just returning -EAGAIN
> everywhere, and no checking for already allocated resources.
> 
> Someone with too much time on their hands[1] could probably clean this
> up to free allocated resources on failure and return -ENOMEM on
> allocation failures.


Yup, but I do not have that much spare time ;)
I just looked at the code for two seconds and thought that I'd send a
quick fix for it.


Regards


Petter Wahlman

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-18 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-18 13:35 small 5575 PCI ATM fix Petter
2002-06-18 13:58 ` Dave Jones
2002-06-18 14:12   ` Petter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox