summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* libfdisk: (bsd) improve checksum calculation [-Waddress-of-packed-member]Karel Zak2019-05-221-5/+12
| | | | | | | | Let's keep compilers and static analyzers happy. The idea is to use memcpy() to copy from buffer to variable and use all label as unsigned char rather than vectorize by unsigned short. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (silicon raid) improve checksum calculation ↵Karel Zak2019-05-221-3/+7
| | | | | | | | | | [-Waddress-of-packed-member] Let's keep compilers and static analyzers happy. The idea is to use memcpy() to copy from buffer to variable and use all label as unsigned char rather than vectorize by uint16_t. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (sgi) improve checksum calculation [-Waddress-of-packed-member]Karel Zak2019-05-221-6/+11
| | | | | | | | Let's keep compilers and static analyzers happy. The idea is to use memcpy() to copy from buffer to variable and use all label as unsigned char rather than vectorize by uint32_t. Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: use __has_attributeKarel Zak2019-05-211-12/+19
| | | | | | | | | | | | | | The __has macros are more portable (supported by gcc as well as clang). The old __GNUC_PREREQ is deprecated and it should be removed in future. (Well, the __has macros are supported since gcc 5, so we should be patient as some old stable distros (e.g. RHEL 7) use gcc 4.x). This patch helps clang to correctly analyze our xalloc.h stuff. Signed-off-by: Karel Zak <kzak@redhat.com>
* bash-completion: add hardlink completionSami Kerola2019-05-201-0/+36
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* bash-completion: update options before releaseSami Kerola2019-05-203-1/+6
| | | | | | | | | | blkid: 5e91d5dd716ebc6144bcb0cabb0ec847a678be9e --no-part-details lsblk: dc4662f0e755929de9cbe98b1b343b492fd620f4 --dedup lsblk: 0bd05f5ee4876ffd13c98acd56c2bff9971f28f1 --merge lscpu: 0e86bc8406959d0d56194d4f404b780e6b70caa4 --caches lscpu: 2011528bce58dd31d5ee0287f2367da1f2d6cfa9 --bytes Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/ismounted: use xstrncpy()Karel Zak2019-05-201-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: use xstrncpy()Karel Zak2019-05-201-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: use xstrncpy()Karel Zak2019-05-201-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: use xstrncpy()Karel Zak2019-05-201-6/+6
| | | | | | It's already used by vipw, so use it everywhere. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: use xstrncpy()Karel Zak2019-05-201-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: use xstrncpy()Karel Zak2019-05-201-8/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use xstrncpy()Karel Zak2019-05-201-6/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: use xstrcpy()Karel Zak2019-05-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: remove unnecessary gotoKarel Zak2019-05-201-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2019wk19' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-207-29/+33
|\ | | | | | | | | | | | | | | | | | | | | * '2019wk19' of https://github.com/kerolasa/util-linux: lib/colors: remove redundant if statement wipefs: fix variable / function shadowing [cppcheck] sulogin: fix variable / function shadowing [cppcheck] lscpu: remove redundant condition check [cppcheck] libmount: avoid possible null pointer dereference [cppcheck] lib/mangle: fix possible null pointer dereference [cppcheck] sfdisk: remove unnecessary size check [cppcheck]
| * lib/colors: remove redundant if statementSami Kerola2019-05-181-3/+1Star
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * wipefs: fix variable / function shadowing [cppcheck]Sami Kerola2019-05-181-4/+4
| | | | | | | | | | | | | | [misc-utils/wipefs.c:636] -> [misc-utils/wipefs.c:310]: (style) Local variable usage shadows outer function Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * sulogin: fix variable / function shadowing [cppcheck]Sami Kerola2019-05-181-4/+5
| | | | | | | | | | | | | | | | | | [login-utils/sulogin.c:398] -> [login-utils/sulogin.c:171]: (style) Local variable set shadows outer function [login-utils/sulogin.c:398] -> [login-utils/sulogin.c:830]: (style) Local variable set shadows outer function Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * lscpu: remove redundant condition check [cppcheck]Sami Kerola2019-05-181-8/+12
| | | | | | | | | | | | | | | | | | [sys-utils/lscpu.c:1783] -> [sys-utils/lscpu.c:1785]: (warning) Either the condition 'desc' is redundant or there is possible null pointer dereference: desc. [sys-utils/lscpu.c:1840] -> [sys-utils/lscpu.c:1842]: (warning) Either the condition 'desc' is redundant or there is possible null pointer dereference: desc. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * libmount: avoid possible null pointer dereference [cppcheck]Sami Kerola2019-05-181-6/+9
| | | | | | | | | | | | [libmount/src/monitor.c:797]: (warning) Possible null pointer dereference: me Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * lib/mangle: fix possible null pointer dereference [cppcheck]Sami Kerola2019-05-181-2/+2
| | | | | | | | | | | | Fix effects code that is used when testing util-linux, so quite low impact. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * sfdisk: remove unnecessary size check [cppcheck]Sami Kerola2019-05-181-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | Following warning is false positive. Size of the buffer is defined using BUFSIZ, and so the strncpy() will never overwrite the last byte that is initialized to zero in get_user_reply(). [disk-utils/sfdisk.c:137] -> [disk-utils/sfdisk.c:136]: (warning) Either the condition 'bufsz!=0' is redundant or strncpy() argument nr 3 can have invalid value. The value is -1 but the valid values are '0:'. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | Merge branch 'lscpu_midr_updates' of https://github.com/jlinton/util-linuxKarel Zak2019-05-201-0/+3
|\ \ | | | | | | | | | | | | * 'lscpu_midr_updates' of https://github.com/jlinton/util-linux: lscpu: Add additional aarch64 models
| * | lscpu: Add additional aarch64 modelsJeremy Linton2019-05-161-0/+3
| |/ | | | | | | | | | | | | | | ARM has released docs for Cortex-A76, Neoverse-N1 and Neoverse-E1. That means we know the midr partnums, so we can add them to the human readable model name table. Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
* | Merge branch 'lscpu-another' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-205-41/+121
|\ \ | | | | | | | | | | | | | | | | | | * 'lscpu-another' of https://github.com/kerolasa/util-linux: lscpu: fix floating point exception include/strutils: fix potential null pointer dereference lscpu: remove extra space from field key name
| * | lscpu: fix floating point exceptionSami Kerola2019-05-183-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the title tells this change indeed fixes floating point exception, but post processing as value overwrite feels a wrong. Possibly something in input is making cpu set count to go wrong, but I could not get my head around what could it be. Anyway avoiding division by zero seems better than crashing so lets do this atleast for now. Caused-by: e5f721132ec8b8c933a396d8dcb3efcb67854f13 Addresses: https://github.com/karelzak/util-linux/issues/788 Reported-by: Lars Wendler <polynomial-c@gentoo.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * | include/strutils: fix potential null pointer dereferenceSami Kerola2019-05-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Recent lscpu fix caused gcc -Wnull-dereference to go off that this change addresses. Reference: b94acada9ed0e11a7e82f8f60280c5b6058e4250 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * | lscpu: remove extra space from field key nameSami Kerola2019-05-162-40/+40
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extra space was more obvious in json output. But as the expected test output displays also the standard output can be effected by this change. $ lscpu --json | jq '.lscpu | .[].field' | grep ': ' "L1d cache: " "L1i cache: " "L2 cache: " "L3 cache: " "Vulnerability L1tf: " "Vulnerability Mds: " "Vulnerability Meltdown: " "Vulnerability Spec store bypass: " "Vulnerability Spectre v1: " "Vulnerability Spectre v2: " Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | findmnt: keep it easy for static analyzersKarel Zak2019-05-161-1/+2
| |
* | findmnt: (verify) check mnt_table_next_fs() return code [coverity scan]Karel Zak2019-05-161-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | fincore: remove unused variable [clang scan]Karel Zak2019-05-161-6/+2Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | cal: make sure months_in_row makes sense [coverity scan]Karel Zak2019-05-161-5/+11
| | | | | | | | | | | | | | * avoid divide by zero in mountly() dues to wrong months_in_row * make sure months_in_row is at least 1 Signed-off-by: Karel Zak <kzak@redhat.com>
* | blkid: improve strcpy() usage [coverity scan]Karel Zak2019-05-161-3/+8
| | | | | | | | | | | | | | The old deprecated list output format ("-o list") copies gettex string into fixed buffer, that's really bad idea. Signed-off-by: Karel Zak <kzak@redhat.com>
* | utmpdump: check ftello() return valueKarel Zak2019-05-161-0/+3
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'lscpu-output-fix' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-162-1/+2
|\ | | | | | | | | * 'lscpu-output-fix' of https://github.com/kerolasa/util-linux: lscpu: move trailing null after removing characters from a string
| * lscpu: move trailing null after removing characters from a stringSami Kerola2019-05-162-1/+2
| | | | | | | | | | | | | | | | | | From the test input string ':' characters are removed: cat x86_64-epyc_7451/sys/devices/system/cpu/vulnerabilities/spectre_v2 Mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | libsmartcols: (groups) improve scols_table_group_lines() args check ↵Karel Zak2019-05-151-3/+3
| | | | | | | | | | | | [coverity scan] Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: fix memory leak on error [coverity scan]Karel Zak2019-05-151-2/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: avoid memory leak [coverity scan]Karel Zak2019-05-151-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: avoid division by zero [clang scan]Karel Zak2019-05-151-2/+7
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: remove unused code [clang scan]Karel Zak2019-05-151-1/+0Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: properly check return code of add_to_partitions_array() [coverity ↵Karel Zak2019-05-151-1/+2
| | | | | | | | | | | | scan] Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: make partitions reference counting more robust [coverity scan]Karel Zak2019-05-151-2/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: don't ignore blkid_probe_set_magic() errors [coverity scan]Karel Zak2019-05-151-4/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: fix possible uninitialized value use [coverity scan]Karel Zak2019-05-151-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/strutils: keep static analyzer happy [coverity scan]Karel Zak2019-05-151-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix resource leak [coverity scan]Karel Zak2019-05-151-2/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix possible NULL dereferencing [coverity scan]Karel Zak2019-05-151-2/+4
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix ul_path_get_dirfd() usage [coverity scan]Karel Zak2019-05-151-1/+5
| | | | | | | | | | | | ul_path_get_dirfd() returns negative number on error... Signed-off-by: Karel Zak <kzak@redhat.com>