On Fri, Dec 18, 2015 at 12:12:05AM +0100, Arnd Bergmann wrote: > On Thursday 17 December 2015 17:58:52 Bamvor Jian Zhang wrote: > > The arg of ioctl in ppdev is the pointer of integer except the > > timeval in PPSETTIME, PPGETTIME. Different size of timeval > > is already supported by the previous patches. So, it is safe > > to add compat support. > > > > Signed-off-by: Bamvor Jian Zhang <bamvor.zhangj...@linaro.org> > > > > Reviewed-by: Arnd Bergmann <a...@arndb.de> > > (I think I replied with the reviewed-by tag before to this patch)
I was testing this series today. And it is breaking my userspace code. I am attaching my userspace code for you to check. Its very simple userspace code: 1: open 2: ioctl to claim 3: ioctl - PPGETTIME 4: ioctl - PPSETTIME 5: ioctl - PPGETTIME 6: ioctl - release 7: close Without this series it works as expected. With this series applied, the userspace code prints the error message: PPNEGOT: Bad address I traced it with strace and: ioctl(3, PPGETTIME, 0xbfe91508) = -1 EFAULT (Bad address) regards sudip
#include <stdio.h> #include<stdlib.h> #include <unistd.h> #include <linux/ioctl.h> #include <linux/parport.h> #include <linux/ppdev.h> #include <fcntl.h> #include <sys/time.h> int main(int argc, char *argv[]) { int fd struct timeval tv; fd = open("/dev/parport0",O_RDWR); if (fd == -1) { perror("open"); exit(1); } if (ioctl(fd,PPCLAIM)) { perror("PPCLAIM"); close(fd); exit(1); } if (ioctl(fd, PPGETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec); tv.tv_sec = 50; tv.tv_usec = 1000; if (ioctl(fd, PPSETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } if (ioctl(fd, PPGETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec); ioctl (fd, PPRELEASE); close(fd); }