Is there a way to get Splint or a similar static check to work with Linux kernel modules?

I compiled (without warning) an example hello-5.cfrom the Linux Kernel Module Programming Guide , and when I tried to enable it, I received the following error:

insmod: error inserting 'hello-5.ko': -1 Unknown symbol in module

I thought I would try splint to see if there were any obvious errors, but when I ran it, I got a lot of warnings from the kernel headers until it tried to parse asm/types.h

anon@anon:~/kernel-source/lkmpg$ splint -I/lib/modules/$(uname -r)/build/include hello-5.c
Splint 3.1.1 --- 03 Nov 2006

( ... lots of warnings ... )

/lib/modules/2.6.24-24-insp8600/build/include/asm/types.h:13:24: Parse Error:
    Suspect missing struct or union keyword: __signed__ :
    unsigned short int. (For help on parse errors, see splint -help
    parseerrors.)
*** Cannot continue.

So there are two questions:

  • How to fix insmod error?
  • How do I get a bus to play well with kernel headers?
+3
source share
2

, , :

splint- Splint Linux

make, gcc , .

+1

. Linux:)

linux, C, , , , " C". , C- , .

, (03 Nov 2006), , , . , , - C-, .

, ​​Linux, , checker , . , , .

+1

Source: https://habr.com/ru/post/1721011/


All Articles