ciaa / firmware_v1

Firmware de la CIAA
http://www.proyecto-ciaa.com.ar
126 stars 120 forks source link

Pointer to lseek is left uninitialized in ciaaSerialDevices_addDriver() #444

Open glpuga opened 7 years ago

glpuga commented 7 years ago

The following fragment of ciaaSerialDevices_addDriver() in ciaaSerialDevices.c should probably also copy the pointer for lseek, or set it to NULL if is not used for this kind of device.

/* allocate memory for new device */
newDevice = (ciaaDevices_deviceType*) ciaak_malloc(sizeof(ciaaDevices_deviceType));

/* set functions for this device */
newDevice->open = ciaaSerialDevices_open;
newDevice->close = ciaaSerialDevices_close;
newDevice->ioctl = ciaaSerialDevices_ioctl;
newDevice->read = ciaaSerialDevices_read;
newDevice->write = ciaaSerialDevices_write;

/* store layers information information */
newDevice->layer = (void *) &ciaaSerialDevices.devstr[position];
newDevice->loLayer = (void *) driver;
mabeett commented 7 years ago

Related files in the current master branch modules/posix/src/ciaaSerialDevices.c#L157 modules/posix/inc/ciaaDevices.h#L107

mcerdeiro commented 7 years ago

Hello Gerardo,

This is a serial driver so it doesn't have a lseek. So I guess it shall never been called. If so we have to set it to null.

What do you think?

Am 28.09.2016 6:06 AM schrieb "Gerardo Puga" notifications@github.com:

The following fragment of ciaaSerialDevices_addDriver() in ciaaSerialDevices.c should probably also copy the pointer for lseek.

/* allocate memory for new device _/ newDevice = (ciaaDevicesdeviceType) ciaak_malloc(sizeof(ciaaDevices_deviceType));

/* set functions for this device */ newDevice->open = ciaaSerialDevices_open; newDevice->close = ciaaSerialDevices_close; newDevice->ioctl = ciaaSerialDevices_ioctl; newDevice->read = ciaaSerialDevices_read; newDevice->write = ciaaSerialDevices_write;

/* store layers information information / newDevice->layer = (void ) &ciaaSerialDevices.devstr[position]; newDevice->loLayer = (void *) driver;

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ciaa/Firmware/issues/444, or mute the thread https://github.com/notifications/unsubscribe-auth/AG7km9NBNbCh35wnIquGbvub7nw0V-o2ks5quefSgaJpZM4KIZV9 .

glpuga commented 7 years ago

Sounds ok to me.