Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#492 closed defect (fixed)

dosfs/fat_file.c: inconsistent types in va_arg-calls

Reported by: Ralf Corsepius Owned by: Jennifer Averett
Priority: normal Milestone: 2
Component: fs/fat Version: 4.6
Severity: major Keywords:
Cc: bugs@…, joel.sherrill@… Blocked By:
Blocking:

Description

From cpukit/libfs/src/dosfs/fat_file.c

fat_file_ioctl(

rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
int cmd,
...)

{
..

unsigned32 pos = 0;
unsigned32 *ret;
va_list ap;


va_start(ap, cmd);


switch (cmd)
{

case F_CLU_NUM:

pos = va_arg(ap, int);
ret = va_arg(ap, int *);

..

pos and ret are fixed size types, while the second args to va_arg are variable sized types.

This breaks on targets where
sizeof(int) != sizeof(unsigned32)

Eg. the -ms variant of the h8300 even warns about it:
../../../../../../../../rtems.master/cpukit/libfs/src/dosfs/fat_file.c:686: warning: assignment from incompatible pointer type

Release:
RTEMS-4.6 + CVS-trunk

Attachments (1)

pr492.diff (629 bytes) - added by Ralf Corsepius on 12/03/06 at 13:31:12.
pr492.diff

Download all attachments as: .zip

Change History (3)

comment:1 Changed on 09/26/03 at 16:21:26 by Joel Sherrill

Status: assignedclosed

State-Changed-From-To: open->closed
State-Changed-Why: Eugeny Mints privately said to use unsigned32 in both cases. The code has been modified accordingly -- see attached patch -- on both the trunk and 4.6 branch (post 4.6.0)

Changed on 12/03/06 at 13:31:12 by Ralf Corsepius

Attachment: pr492.diff added

pr492.diff

comment:2 Changed on 10/10/17 at 06:50:58 by Sebastian Huber

Component: fsfs/fat
Note: See TracTickets for help on using tickets.