Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/hp300/dev



Am 30.04.2024 um 11:55 schrieb Izumi Tsutsui:
> Module Name:	src
> Committed By:	tsutsui
> Date:		Tue Apr 30 09:55:46 UTC 2024
>
> Modified Files:
> 	src/sys/arch/hp300/dev: dma.c
>
> Log Message:
> Fix another fatal typo that prevents dma(4) interrupts.

The buggy code was:
> 	if ((sc->sc_ipl == ipl) == 0) {

The typo in the first '==' can be found by treating bool as a data type
incompatible with any other scalar type, and this is what lint does in
its "strict bool mode".

Lint is not yet ready for the whole kernel source, as it errors out on
232 of the 3223 source files. But it can check hp300/dma.c, and running
it with the extra flag -T finds the bug, among several false positives.

If you want to play around a bit, the attached patch allows you to
suppress the uninteresting lint warnings in the kernel source, and to
configure per-file lint flags. To detect the above bug in dma.c 1.47, run:

    cd OBJDIR/sys/arch/hp300/compile/GENERIC
    make dma.ln KERNLINTFLAGS.dma.c=-T

Roland
Index: sys/conf/lint.mk
===================================================================
RCS file: /cvsroot/src/sys/conf/lint.mk,v
retrieving revision 1.5
diff -u -r1.5 lint.mk
--- sys/conf/lint.mk	27 Aug 2022 21:49:33 -0000	1.5
+++ sys/conf/lint.mk	30 Apr 2024 22:50:59 -0000
@@ -5,11 +5,25 @@
 ##
 
 .if !target(lint)
+DEFKERNLINTFLAGS=	-bceghnxzFS
+DEFKERNLINTFLAGS+=	-X 0	# empty declaration
+DEFKERNLINTFLAGS+=	-X 2	# empty declaration
+DEFKERNLINTFLAGS+=	-X 56	# integral constant too large
+DEFKERNLINTFLAGS+=	-X 129	# expression with null effect
+DEFKERNLINTFLAGS+=	-X 161	# constant in conditional context
+DEFKERNLINTFLAGS+=	-X 226	# static variable unused
+DEFKERNLINTFLAGS+=	-X 231	# unused parameter
+DEFKERNLINTFLAGS+=	-X 236	# unused static function
+DEFKERNLINTFLAGS+=	-X 247	# pointer cast may be troublesome
+DEFKERNLINTFLAGS+=	-X 309	# lossy bitwise '&'
+DEFKERNLINTFLAGS+=	-X 351	# missing header declaration
+DEFKERNLINTFLAGS+=	-X 352	# nested 'extern' declaration
+
 .PATH: $S
 ALLSFILES?=	${MD_SFILES} ${SFILES}
 LINTSTUBS?=	${ALLSFILES:T:R:%=LintStub_%.c}
-KERNLINTFLAGS?=	-bceghnxzFS
-NORMAL_LN?=	${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -o $@ -i $<
+KERNLINTFLAGS?=	${DEFKERNLINTFLAGS}
+NORMAL_LN?=	${LINT} ${KERNLINTFLAGS} ${KERNLINTFLAGS.${.IMPSRC:T}} ${CPPFLAGS:M-[IDU]*} -o $@ -i $<
 
 _lsrc=		${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
 LOBJS?=		${_lsrc:T:.c=.ln} ${LIBKERNLN} ${SYSLIBCOMPATLN}


Home | Main Index | Thread Index | Old Index