Do not cast the ioctl argument type

Type conversion is not required in this case. It simply masks the type
of the argument.

Signed-off-by: Alexey Gladkov <legion@kernel.org>
This commit is contained in:
Alexey Gladkov 2025-10-27 20:33:05 +01:00
parent db82eb6f86
commit ac7a91547c
No known key found for this signature in database
GPG Key ID: A45ABA544CFFD434
4 changed files with 13 additions and 13 deletions

View File

@ -23,7 +23,7 @@ int main(void)
ke.kb_table = i;
ke.kb_value = K_HOLE;
if (ioctl(fd, KDSKBENT, (unsigned long)&ke)) {
if (ioctl(fd, KDSKBENT, &ke)) {
perror("KDSKBENT");
fprintf(stderr, "Error: cannot deallocate or clear keymap %d key %d\n", i, j);
return EXIT_FAILURE;
@ -35,7 +35,7 @@ int main(void)
ke.kb_table = i;
ke.kb_value = K_NOSUCHMAP;
if (ioctl(fd, KDSKBENT, (unsigned long)&ke)) {
if (ioctl(fd, KDSKBENT, &ke)) {
perror("KDSKBENT");
fprintf(stderr, "Error: could not deallocate keymap %d\n", i);
return EXIT_FAILURE;

View File

@ -35,7 +35,7 @@ int lk_kernel_keys(struct lk_ctx *ctx, int fd)
ke.kb_index = (unsigned char) i;
ke.kb_value = 0;
if (ioctl(fd, KDGKBENT, (unsigned long)&ke)) {
if (ioctl(fd, KDGKBENT, &ke)) {
ERR(ctx, _("KDGKBENT: %s: error at index %d in table %d"),
strerror(errno), i, t);
return -1;
@ -67,7 +67,7 @@ int lk_kernel_funcs(struct lk_ctx *ctx, int fd)
}
kbs.kb_func = (unsigned char) i;
if (ioctl(fd, KDGKBSENT, (unsigned long)&kbs)) {
if (ioctl(fd, KDGKBSENT, &kbs)) {
ERR(ctx, _("KDGKBSENT: %s: Unable to get function key string"),
strerror(errno));
return -1;
@ -97,7 +97,7 @@ int lk_kernel_diacrs(struct lk_ctx *ctx, int fd)
int i;
struct lk_kbdiacr dcr = { 0 };
if (ioctl(fd, request, (unsigned long)&kd)) {
if (ioctl(fd, request, &kd)) {
ERR(ctx, _("KDGKBDIACR(UC): %s: Unable to get accent table"),
strerror(errno));
return -1;

View File

@ -197,7 +197,7 @@ deffuncs(struct lk_ctx *ctx, int fd)
if (ptr) {
strlcpy((char *)kbs.kb_string, ptr, sizeof(kbs.kb_string));
if (ioctl(fd, KDSKBSENT, (unsigned long)&kbs)) {
if (ioctl(fd, KDSKBSENT, &kbs)) {
s = ostr(ctx, (char *)kbs.kb_string);
if (s == NULL)
return -1;
@ -210,7 +210,7 @@ deffuncs(struct lk_ctx *ctx, int fd)
} else if (ctx->flags & LK_FLAG_CLEAR_STRINGS) {
kbs.kb_string[0] = 0;
if (ioctl(fd, KDSKBSENT, (unsigned long)&kbs)) {
if (ioctl(fd, KDSKBSENT, &kbs)) {
ERR(ctx, _("failed to clear string %s"),
get_sym(ctx, KT_FN, kbs.kb_func));
} else {
@ -250,7 +250,7 @@ defdiacs(struct lk_ctx *ctx, int fd)
j++;
}
if (ioctl(fd, KDSKBDIACRUC, (unsigned long)&kdu)) {
if (ioctl(fd, KDSKBDIACRUC, &kdu)) {
ERR(ctx, "KDSKBDIACRUC: %s", strerror(errno));
return -1;
}
@ -279,7 +279,7 @@ defdiacs(struct lk_ctx *ctx, int fd)
j++;
}
if (ioctl(fd, KDSKBDIACR, (unsigned long)&kd)) {
if (ioctl(fd, KDSKBDIACR, &kd)) {
ERR(ctx, "KDSKBDIACR: %s", strerror(errno));
return -1;
}

View File

@ -26,7 +26,7 @@ valid_type(int fd, int t)
ke.kb_table = 0;
ke.kb_value = (unsigned short) K(t, 0);
return (ioctl(fd, KDSKBENT, (unsigned long)&ke) == 0);
return (ioctl(fd, KDSKBENT, &ke) == 0);
}
static unsigned char
@ -40,15 +40,15 @@ maximum_val(int fd, int t)
ke.kb_value = K_HOLE;
ke0 = ke;
ioctl(fd, KDGKBENT, (unsigned long)&ke0);
ioctl(fd, KDGKBENT, &ke0);
for (i = 0; i < 256; i++) {
ke.kb_value = (unsigned short) K(t, i);
if (ioctl(fd, KDSKBENT, (unsigned long)&ke))
if (ioctl(fd, KDSKBENT, &ke))
break;
}
ke.kb_value = K_HOLE;
ioctl(fd, KDSKBENT, (unsigned long)&ke0);
ioctl(fd, KDSKBENT, &ke0);
return (unsigned char) (i - 1);
}