Hi,

I find mknodat() in glibc will check the argument, like this,

  ...
  /* We must convert the value to dev_t type used by the kernel.  */
  unsigned long long int k_dev =  (*dev) & ((1ULL << 32) - 1);
  if (k_dev != *dev)
    {
      __set_errno (EINVAL);
      return -1;
    }
  ...

So shall we add argument check in uclibc's mknodat() too?

int mknodat(int fd, const char *path, mode_t mode, dev_t dev)
{
        unsigned long long int k_dev;

        /* We must convert the value to dev_t type used by the kernel.  */
        k_dev = (dev) & ((1ULL << 32) - 1);

        // just like this?
        if (k_dev != dev)
          {
            __set_errno (EINVAL);
            return -1;
          }

        return INLINE_SYSCALL(mknodat, 4, fd, path, mode, (unsigned int)k_dev);
}

Thanks,
Xishi Qiu

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to