Bug 1043304 - cppcheck warnings and errors
Summary: cppcheck warnings and errors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-15 20:24 UTC by Rahul Sundaram
Modified: 2014-02-24 12:34 UTC (History)
7 users (show)

Fixed In Version: systemd-208-14.fc20
Clone Of:
Environment:
Last Closed: 2014-02-24 12:34:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Rahul Sundaram 2013-12-15 20:24:47 UTC
Description of problem:

I have been playing around with cppcheck and it emits a number of warnings (and errors), some of them appears serious enough to look into

cppcheck . --std=c99 --quiet 

[src/boot/bootctl.c:161]: (error) printf format string requires 16 parameters but only 1 is given.
[src/boot/bootctl.c:174]: (error) printf format string requires 16 parameters but only 1 is given.
[src/core/load-fragment.c:2652]: (error) syntax error
[src/core/service.c:1073]: (error) syntax error
[src/libsystemd-bus/bus-kernel.c:583]: (error) Uninitialized variable: d
[src/libsystemd-bus/bus-objects.c:1377]: (error) Memory leak: s
[src/locale/localed.c:763]: (error) Memory leak: new_keymap
[src/nspawn/nspawn.c:601]: (error) snprintf format string requires 16 parameters but only 1 is given.
[src/shared/cgroup-show.c:266]: (error) Memory leak: copy
[src/shared/cgroup-util.c:806]: (error) Resource leak: f
[src/shared/fileio.c:118]: (error) Resource leak: f
[src/shared/hwclock.c:104]: (error) Resource leak: f
[src/shared/install.c:1708]: (error) Memory leak: path
[src/shared/install.c:1815]: (error) Resource leak: f
[src/shared/sleep-config.c:190]: (warning) %zd in format string (no. 3) requires 'size_t *' but the argument type is 'size_t * {aka unsigned long *}'.
[src/shared/sleep-config.c:190]: (warning) %zd in format string (no. 4) requires 'size_t *' but the argument type is 'size_t * {aka unsigned long *}'.
[src/shared/sleep-config.c:221]: (error) Resource leak: f
[src/shared/time-util.c:386]: (warning) %lli in format string (no. 1) requires 'long long *' but the argument type is 'unsigned long long *'.
[src/sleep/sleep.c:104]: (error) Resource leak: f
[src/udev/net/link-config.c:189]: (error) Resource leak: file
[src/udev/scsi_id/scsi_id.c:634]: (error) Memory leak: newargv
[src/udev/udev-builtin-net_id.c:185]: (warning) %d in format string (no. 4) requires 'int *' but the argument type is 'unsigned int *'.
[src/udev/udev-builtin-net_id.c:344]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'.

Comment 1 Zbigniew Jędrzejewski-Szmek 2013-12-15 22:56:07 UTC
Many of those are invalid, but a few are not.

Commits http://cgit.freedesktop.org/systemd/systemd/commit/?id=b5dd8148730
and http://cgit.freedesktop.org/systemd/systemd/commit/?id=b5dd8148730^ fix all issues from this list except 'Memory leak: newargv'. This last one doesn't really matter, because it is a short-lived program. I have a local patch which cleans up scsi_id.c, but it needs a bit more testing.

Thanks, this proved useful.

Comment 2 Fedora Update System 2014-01-15 01:26:23 UTC
systemd-208-11.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-11.fc20

Comment 3 Fedora Update System 2014-01-16 07:02:40 UTC
Package systemd-208-11.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-11.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-0902/systemd-208-11.fc20
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-02-17 07:38:42 UTC
systemd-208-13.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-13.fc20

Comment 5 Fedora Update System 2014-02-17 15:07:11 UTC
systemd-208-14.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-14.fc20

Comment 6 Fedora Update System 2014-02-24 12:34:08 UTC
systemd-208-14.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.