how to correct this problem ?
See your buffer address, it's not aligned. You need to align that as
well. This is needed because the hardware will dma directly to the user
buffer, and to be on the safe side we require the same alignment as the
block layer will normally generate for file system io.
So in short, just align your read buffer to the same as your block size
and you will be fine. Example:
#define BS (4096)
#define MASK (BS - 1)
#define ALIGN(buf) (((unsigned long) (buf) + MASK) & ~(MASK))
char *ptr = malloc(BS + MASK);
char *buf = (char *) ALIGN(ptr);
read(fd, buf, BS);