Hi all,
I noticed that cppcheck and pyflakes are detecting some possible issues in the osmocom-bb codebase on the master branch:
./src/target_dsp/calypso/dump2coff.py:3: 'namedtuple' imported but unused ./src/host/fb_tools/bdf_to_c.py:30: 'string' imported but unused
[src/host/layer23/src/common/main.c:146]: (error) Possible null pointer dereference: app_opp [src/host/gsmmap/gsmmap.c:379] -> [src/host/gsmmap/gsmmap.c:384]: (error) Possible null pointer dereference: meas - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gb/gprs_bssgp.c:1076] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gb/gprs_bssgp.c:1087] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gb/gprs_bssgp.c:1088] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gsm/lapd_core.c:1936] -> [src/shared/libosmocore/src/gsm/lapd_core.c:1948]: (error) Possible null pointer dereference: msg - otherwise it is redundant to check it against null. [src/target/firmware/apps/chainload/main.c:39]: (error) Possible null pointer dereference: entry [src/target/firmware/apps/loader/main.c:92]: (error) Possible null pointer dereference: entry [src/target/firmware/apps/loader_mtk/main.c:87]: (error) Possible null pointer dereference: entry [src/target/ui-experiment/png2tiny.c:20]: (error) printf format string has 1 parameters but only 0 are given. [src/target/firmware/rf/mt6139.c:138]: (error) Uninitialized variable: pga_gain
On Sat, Sep 29, 2012 at 07:20:15PM +0800, Paul Wise wrote:
Hi all,
./src/target_dsp/calypso/dump2coff.py:3: 'namedtuple' imported but unused ./src/host/fb_tools/bdf_to_c.py:30: 'string' imported but unused
please create a patch for that/these.
[src/target/firmware/apps/chainload/main.c:39]: (error) Possible null pointer dereference: entry
that is actually the point of the method. :)
[src/host/layer23/src/common/main.c:146]: (error) Possible null pointer dereference: app_opp
the tool is wrong here. app_opp == NULL iff app_len == 0 (or it should be).
[src/host/gsmmap/gsmmap.c:379] -> [src/host/gsmmap/gsmmap.c:384]: (error) Possible null pointer dereference: meas - otherwise it is redundant to check it against null.
the code could use do {} while(); instead of while to make the warning go away.
[src/shared/libosmocore/src/gb/gprs_bssgp.c:1076] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gb/gprs_bssgp.c:1087] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gb/gprs_bssgp.c:1088] -> [src/shared/libosmocore/src/gb/gprs_bssgp.c:1041]: (error) Possible null pointer dereference: dup - otherwise it is redundant to check it against null. [src/shared/libosmocore/src/gsm/lapd_core.c:1936] -> [src/shared/libosmocore/src/gsm/lapd_core.c:1948]: (error) Possible null pointer dereference: msg - otherwise it is redundant to check it against null.
propably right, didn't check these.
[src/target/ui-experiment/png2tiny.c:20]: (error) printf format string has 1 parameters but only 0 are given.
gcc by itself should warn about it.
mtk: probably right but the code is not used on many devices.
[src/target/firmware/apps/loader/main.c:92]: (error) Possible null pointer dereference: entry [src/target/firmware/apps/loader_mtk/main.c:87]: (error) Possible null pointer dereference: entry [src/target/firmware/rf/mt6139.c:138]: (error) Uninitialized variable: pga_gain
-- bye, pabs
--- src/host/fb_tools/bdf_to_c.py | 1 - src/target_dsp/calypso/dump2coff.py | 1 - 2 files changed, 2 deletions(-)
diff --git a/src/host/fb_tools/bdf_to_c.py b/src/host/fb_tools/bdf_to_c.py index 2a3a644..86be6a6 100755 --- a/src/host/fb_tools/bdf_to_c.py +++ b/src/host/fb_tools/bdf_to_c.py @@ -27,7 +27,6 @@ selected glyphs in the format defined by the <fb/font.h> header. from optparse import OptionParser import sys import os -import string
def unique_name(thisname,existingnames) : # return first of thisname, thisname_1, thisname_2, ... diff --git a/src/target_dsp/calypso/dump2coff.py b/src/target_dsp/calypso/dump2coff.py index 67a49e8..c05a0ff 100755 --- a/src/target_dsp/calypso/dump2coff.py +++ b/src/target_dsp/calypso/dump2coff.py @@ -1,6 +1,5 @@ #!/usr/bin/env python
-from collections import namedtuple import re import sys import struct
On Sun, Sep 30, 2012 at 8:12 PM, Holger Hans Peter Freyther wrote:
On Sat, Sep 29, 2012 at 07:20:15PM +0800, Paul Wise wrote:
[src/target/firmware/apps/chainload/main.c:39]: (error) Possible null pointer dereference: entry
that is actually the point of the method. :)
Hmmm, should I file a bug on cppcheck about this? I guess jumping to address zero is something rarely done though so probably not.
[src/host/layer23/src/common/main.c:146]: (error) Possible null pointer dereference: app_opp
the tool is wrong here. app_opp == NULL iff app_len == 0 (or it should be).
Hmm, probably not possible for cppcheck to deduce that since app_opp is set in another file.
baseband-devel@lists.osmocom.org