public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31706] New: The "quotactl" function type declared by glibc is different from the quotactl system call function type defined by the Linux kernel.
@ 2024-05-07  2:02 xiaojiangfeng at huawei dot com
  2024-05-07  2:03 ` [Bug libc/31706] " xiaojiangfeng at huawei dot com
  0 siblings, 1 reply; 2+ messages in thread
From: xiaojiangfeng at huawei dot com @ 2024-05-07  2:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31706

            Bug ID: 31706
           Summary: The "quotactl" function type declared by glibc is
                    different from the quotactl system call function type
                    defined by the Linux kernel.
           Product: glibc
           Version: 2.40
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: xiaojiangfeng at huawei dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

glibc:
extern int quotactl (int __cmd, const char *__special, int __id, __caddr_t
__addr) __THROW;

linux kernel:
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
qid_t, id, void __user *, addr)

The type of the first input parameter "cmd" of quotactl of glibc is int, but
that of the first input parameter "cmd" of syscall quotactl of the Linux kernel
is unsigned int.



This difference may cause the following code compilation failures:

```
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/quota.h>
#include <linux/dqblk_xfs.h>

int main()
{
        (void)quotactl(QCMD((uint32_t)Q_SETQUOTA, FS_PROJ_QUOTA),
"/dev/loop10", 0, NULL);
        return 0;
}
```

gcc -Werror -Wsign-conversion quotactl_test.c -o quotactl_test
quotactl_test.c: In function ‘main’:
quotactl_test.c:9:24: error: signed conversion from ‘unsigned int’ to ‘int’
changes value from ‘2147485698’ to ‘-2147481598’ [-Werror=sign-conversion]
    9 |         (void)quotactl(QCMD((uint32_t)Q_SETQUOTA, FS_PROJ_QUOTA),
"/dev/loop10", 0, NULL);
      |                        ^~~~
cc1: all warnings being treated as errors

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/31706] The "quotactl" function type declared by glibc is different from the quotactl system call function type defined by the Linux kernel.
  2024-05-07  2:02 [Bug libc/31706] New: The "quotactl" function type declared by glibc is different from the quotactl system call function type defined by the Linux kernel xiaojiangfeng at huawei dot com
@ 2024-05-07  2:03 ` xiaojiangfeng at huawei dot com
  0 siblings, 0 replies; 2+ messages in thread
From: xiaojiangfeng at huawei dot com @ 2024-05-07  2:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31706

xiaojiangfeng <xiaojiangfeng at huawei dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xiaojiangfeng at huawei dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-07  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07  2:02 [Bug libc/31706] New: The "quotactl" function type declared by glibc is different from the quotactl system call function type defined by the Linux kernel xiaojiangfeng at huawei dot com
2024-05-07  2:03 ` [Bug libc/31706] " xiaojiangfeng at huawei dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).