kernel: Fix some compiler warnings/errors

Co-Authored-By: Yaroslav Zviezda <10716792+acroreiser@users.noreply.github.com>
This commit is contained in:
Trijal Saha
2025-05-18 14:05:51 -04:00
committed by Rifat Azad
parent aa32835ff6
commit 96313743a2
2 changed files with 10 additions and 11 deletions

View File

@@ -32,7 +32,7 @@ static struct sdesc *init_sdesc(struct crypto_shash *alg)
size = sizeof(struct shash_desc) + crypto_shash_descsize(alg);
sdesc = kmalloc(size, GFP_KERNEL);
if (!sdesc)
return ERR_PTR(-ENOMEM);
return NULL;
sdesc->shash.tfm = alg;
return sdesc;
}
@@ -44,9 +44,9 @@ static int calc_hash(struct crypto_shash *alg, const unsigned char *data,
int ret;
sdesc = init_sdesc(alg);
if (IS_ERR(sdesc)) {
if (sdesc == NULL) {
pr_info("can't alloc sdesc\n");
return PTR_ERR(sdesc);
return -ENOMEM;
}
ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest);
@@ -100,7 +100,7 @@ static bool check_block(struct file *fp, u32 *size4, loff_t *pos, u32 *offset,
}
ksu_kernel_read_compat(fp, cert, *size4, pos);
unsigned char digest[SHA256_DIGEST_SIZE];
if (IS_ERR(ksu_sha256(cert, *size4, digest))) {
if (ksu_sha256(cert, *size4, digest)) {
pr_info("sha256 error\n");
return false;
}
@@ -317,4 +317,4 @@ module_param_cb(ksu_debug_manager_uid, &expected_size_ops,
bool is_manager_apk(char *path)
{
return check_v2_signature(path, EXPECTED_NEXT_SIZE, EXPECTED_NEXT_HASH);
}
}

View File

@@ -319,7 +319,7 @@ static ssize_t read_proxy(struct file *file, char __user *buf, size_t count,
bool first_read = file->f_pos == 0;
ssize_t ret = orig_read(file, buf, count, pos);
if (first_read) {
pr_info("read_proxy append %ld + %ld\n", ret,
pr_info("read_proxy append %zu + %zu\n", ret,
read_count_append);
ret += read_count_append;
}
@@ -331,7 +331,7 @@ static ssize_t read_iter_proxy(struct kiocb *iocb, struct iov_iter *to)
bool first_read = iocb->ki_pos == 0;
ssize_t ret = orig_read_iter(iocb, to);
if (first_read) {
pr_info("read_iter_proxy append %ld + %ld\n", ret,
pr_info("read_iter_proxy append %zu + %zu\n", ret,
read_count_append);
ret += read_count_append;
}
@@ -530,9 +530,9 @@ __maybe_unused int ksu_handle_execve_ksud(const char __user *filename_user,
filename_in.name = path;
filename_p = &filename_in;
return ksu_handle_execveat_ksud(AT_FDCWD, &filename_p, &argv, NULL, NULL);
return ksu_handle_execveat_ksud(NULL, &filename_p, &argv, NULL, NULL);
#else
return ksu_handle_execveat_ksud(AT_FDCWD, path, &argv, NULL, NULL);
return ksu_handle_execveat_ksud(NULL, path, &argv, NULL, NULL);
#endif
}
@@ -578,8 +578,7 @@ static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
filename_in.name = path;
filename_p = &filename_in;
return ksu_handle_execveat_ksud(AT_FDCWD, &filename_p, &argv, NULL,
NULL);
return ksu_handle_execveat_ksud(NULL, &filename_p, &argv, NULL, NULL);
}
// remove this later!