bugDazuko - Bugs: bug #9435, Possible bug with atoi function in...

 
 

bug #9435: Possible bug with atoi function in dasukoio.c

Submitter:  Andre DUCLOS <shirka>
Submitted:  Wed 23 Jun 2004 05:37:59 PM UTC
   
 
Status:  None Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 19 Jul 2004 09:09:23 PM UTC, comment #3: 

Hi,

Thanks for the information. I will add the device number parameter in an upcoming release.

John Ogness

John Ogness <ogman>
Group administrator
Wed 30 Jun 2004 12:42:08 PM UTC, comment #2: 

Hi,

Yes, 0 is not allowed for device number. It's used for dynamic allowance device number by (devfs_)registered_chrdev.
But you're right because your module never send 0 for device number ;)

Can you add device number parameter to your module.
Look at how I made for my project : http://www.shirka.org/cgi-bin/viewcvs.cgi/recycled/kernel/Linux/2.4/ioctl.c.diff?r1=1.9&r2=1.10

Bye.

Andre DUCLOS <shirka>
Wed 30 Jun 2004 09:39:35 AM UTC, comment #1: 

Hi,

This is a good point. This would be OK as long as 0 is not allowed to be a device number. ??

If "bad number" were to be given to the register function, it would not be a problem. Dazuko would simply try to attach to device major number 0. I'll need to check to see if that would cause any kind of problems.

John Ogness

John Ogness <ogman>
Group administrator
Wed 23 Jun 2004 05:37:59 PM UTC, original submission:  

Hi John,

I think that there is a minor bug in the function dazukoRegister_TS here :
   temp_id->dev_major = atoi(buffer);
-> if (temp_id->dev_major < 0)

If you run this test following :
#include <stdlib.h>

int main(void)
{
        int dev = -1;

        dev = atoi("bad number");
        printf("dev=%d\n", dev);
}

result : dev=0
atoi don't return error, but if it does not translate any digit, it returns 0.

I think then :
- if (temp_id->dev_major < 0)
+ if (temp_id->dev_major <= 0)

or use strol function.

Best regards.

Andre DUCLOS <shirka>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ogman (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-03-19 ogman Assigned toogman None
    2004-06-30 shirka Carbon-Copy- Added ogman
    2004-06-30 ogman Assigned toNone ogman

    Back to the top

    Powered by Savane 3.13-8ccc.
    Corresponding source code