ioctl: fix ioctl command number decoding in case of conflicts

When a command number was decoded through ioctl_decode_command_number(),
there was no check for conflicts with other potential ioctls numbers.

For example:
	ioctl(fd, MCE_GET_RECORD_LEN, &i);
output:
	ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
instead of:
	ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0

* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
in case of conflicts.
* tests/ioctl.c (main): Add a case for command number conflicts.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2 files changed
tree: bea8f1cd25ee06e61e9e37d9e21ab9c719fd974d
  1. debian/
  2. linux/
  3. m4/
  4. maint/
  5. qemu_multiarch_testing/
  6. test/
  7. tests/
  8. xlat/
  9. .gitignore
  10. .mailmap
  11. access.c
  12. affinity.c
  13. aio.c
  14. AUTHORS
  15. bjm.c
  16. block.c
  17. bootstrap
  18. bpf.c
  19. build_static_example.sh
  20. cacheflush.c
  21. capability.c
  22. caps0.h
  23. caps1.h
  24. ChangeLog-CVS
  25. chdir.c
  26. chmod.c
  27. clone.c
  28. configure.ac
  29. COPYING
  30. count.c
  31. CREDITS.in
  32. defs.h
  33. desc.c
  34. dirent.c
  35. empty.h
  36. epoll.c
  37. errnoent.sh
  38. evdev.c
  39. eventfd.c
  40. execve.c
  41. exit.c
  42. fadvise.c
  43. fallocate.c
  44. fanotify.c
  45. fchownat.c
  46. fetch_seccomp_fprog.c
  47. file.c
  48. futex.c
  49. generate_mpers_am.sh
  50. generate_sen.sh
  51. generate_xlat_in.sh
  52. get_robust_list.c
  53. getcpu.c
  54. getcwd.c
  55. getrandom.c
  56. git-set-file-times
  57. git-version-gen
  58. gitlog-to-changelog
  59. HACKING-scripts
  60. hostname.c
  61. inotify.c
  62. INSTALL
  63. io.c
  64. ioctl.c
  65. ioctlsort.c
  66. ioprio.c
  67. ipc_defs.h
  68. ipc_msg.c
  69. ipc_msgctl.c
  70. ipc_sem.c
  71. ipc_shm.c
  72. ipc_shmctl.c
  73. kexec.c
  74. keyctl.c
  75. ldt.c
  76. link.c
  77. loop.c
  78. lseek.c
  79. make-dist
  80. Makefile.am
  81. mem.c
  82. memfd_create.c
  83. mknod.c
  84. mount.c
  85. mpers.awk
  86. mpers.sh
  87. mpers_test.sh
  88. mpers_type.h
  89. mq.c
  90. mtd.c
  91. native_defs.h
  92. net.c
  93. NEWS
  94. open.c
  95. or1k_atomic.c
  96. pathtrace.c
  97. perf.c
  98. personality.c
  99. poll.c
  100. prctl.c
  101. print_mq_attr.c
  102. print_msgbuf.c
  103. print_sigevent.c
  104. print_time.c
  105. print_timex.c
  106. printmode.c
  107. printrusage.c
  108. printsiginfo.c
  109. printsiginfo.h
  110. printstat.h
  111. process.c
  112. process_vm.c
  113. ptp.c
  114. ptrace.h
  115. quota.c
  116. readahead.c
  117. readlink.c
  118. README
  119. README-hacking
  120. README-linux-ptrace
  121. README-mpers
  122. reboot.c
  123. regs.h
  124. renameat.c
  125. resource.c
  126. rtc.c
  127. sched.c
  128. scsi.c
  129. seccomp.c
  130. seccomp_fprog.h
  131. sendfile.c
  132. sigaltstack.c
  133. signal.c
  134. signalent.sh
  135. signalfd.c
  136. sigreturn.c
  137. sock.c
  138. socketutils.c
  139. sram_alloc.c
  140. statfs.c
  141. strace-graph
  142. strace-log-merge
  143. strace.1
  144. strace.c
  145. strace.spec
  146. stream.c
  147. swapon.c
  148. sync_file_range.c
  149. syscall.c
  150. syscallent.sh
  151. sysctl.c
  152. sysinfo.c
  153. syslog.c
  154. sysmips.c
  155. term.c
  156. time.c
  157. times.c
  158. truncate.c
  159. uid.c
  160. uid16.c
  161. umask.c
  162. umount.c
  163. uname.c
  164. unwind.c
  165. util.c
  166. utime.c
  167. utimes.c
  168. v4l2.c
  169. vsprintf.c
  170. wait.c
  171. xattr.c
  172. xlate.el
  173. xmalloc.c