]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite/{init,delete}_module: add TODOs for args validation
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 29 May 2025 14:31:36 +0000 (15:31 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 11 Jun 2025 12:54:40 +0000 (07:54 -0500)
Currently we pass arguments to our *_module wrappers, which are lacking
any validation. Add a few TODO notes and silence the unused argument
compiler warnings.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
testsuite/delete_module.c
testsuite/init_module.c

index 84bf0ff8c724f183864ced44ab6eac3951554fa5..023f58a148976d42e44f36ff473b0e8ff8f2ad1e 100644 (file)
@@ -186,7 +186,8 @@ fail:
  */
 TS_EXPORT long delete_module(const char *name, unsigned int flags);
 
-long delete_module(const char *modname, unsigned int flags)
+/* TODO: add simple validation of the flags passed and remove the _maybe_unused_ workaround */
+long delete_module(const char *modname, _maybe_unused_ unsigned int flags)
 {
        DECLARE_STRBUF_WITH_STACK(buf, PATH_MAX);
        struct mod *mod;
index 82942a701423211bfee25563aa16b1be66bf01ba..8ff26999624b08af119d1ea3dfd3b13e1c2249db 100644 (file)
@@ -224,7 +224,8 @@ TS_EXPORT long init_module(void *mem, unsigned long len, const char *args);
  * This is because we want to be able to pass dummy modules (and not real
  * ones) and it still work.
  */
-long init_module(void *mem, unsigned long len, const char *args)
+/* TODO: add simple validation of the args passed and remove the _maybe_unused_ workaround */
+long init_module(void *mem, unsigned long len, _maybe_unused_ const char *args)
 {
        const char *modname;
        struct kmod_elf *elf;
@@ -300,7 +301,8 @@ static int check_kernel_version(int major, int minor)
 
 TS_EXPORT int finit_module(const int fd, const char *args, const int flags);
 
-int finit_module(const int fd, const char *args, const int flags)
+/* TODO: add simple validation of the flags passed and remove the _maybe_unused_ workaround */
+int finit_module(const int fd, const char *args, _maybe_unused_ const int flags)
 {
        int err;
        void *mem;