Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Fix use of uninitialized value
Browse files Browse the repository at this point in the history
==1116== Syscall param ioctl(generic) points to uninitialised byte(s)
==1116==    at 0x4F168B7: ioctl (syscall-template.S:84)
==1116==    by 0x400BB0: transfer (in /usr/bin/spi_xfer)
==1116==    by 0x400EFF: main (in /usr/bin/spi_xfer)
==1116==  Address 0xfff000a34 is on thread 1's stack
==1116==  in frame #1, created by transfer (???:)
  • Loading branch information
lucasdemarchi committed May 16, 2017
1 parent c47cbce commit 16054d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spidev-app/spi_xfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ void transfer(struct spidev *dev, struct transfer *tr)
return;
}

memset(&iotr, 0, sizeof(iotr));
memcpy(tx, &tr->data, tr->len);
memset(&tx[tr->len], 0x00, len - tr->len);
memset(rx, 0xff, len);
memset(rx, 0x00, len);

printf("TX: ");
for (i = 0; i < len; i++)
Expand Down

0 comments on commit 16054d3

Please sign in to comment.