summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/strutils.h4
-rw-r--r--login-utils/utmpdump.c3
-rw-r--r--misc-utils/blkid.c11
-rw-r--r--misc-utils/cal.c16
-rw-r--r--misc-utils/fincore.c8
-rw-r--r--misc-utils/findmnt-verify.c4
-rw-r--r--misc-utils/findmnt.c3
-rw-r--r--sys-utils/lscpu-arm.c3
-rw-r--r--sys-utils/lscpu.c8
-rw-r--r--tests/expected/lscpu/lscpu-vmware_fpe76
-rw-r--r--tests/expected/lscpu/lscpu-x86_64-epyc_745174
-rw-r--r--tests/ts/lscpu/dumps/vmware_fpe.tar.gzbin0 -> 59743 bytes
12 files changed, 153 insertions, 57 deletions
diff --git a/include/strutils.h b/include/strutils.h
index 50733c5f5..d1f3da1b6 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -258,7 +258,9 @@ static inline void strrem(char *s, int rem)
{
char *p;
- for (p = s; s && *s; s++) {
+ if (!s)
+ return;
+ for (p = s; *s; s++) {
if (*s != rem)
*p++ = *s;
}
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index f1a3607dc..defa230b9 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -169,6 +169,9 @@ static int follow_by_inotify(FILE *in, const char *filename, FILE *out)
size = ftello(in);
fclose(in);
+ if (size < 0)
+ err(EXIT_FAILURE, _("%s: cannot get file position"), filename);
+
wd = inotify_add_watch(fd, filename, EVENTS);
if (wd == -1)
err(EXIT_FAILURE, _("%s: cannot add inotify watch."), filename);
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
index 2b13f71c0..f2583d2b8 100644
--- a/misc-utils/blkid.c
+++ b/misc-utils/blkid.c
@@ -225,13 +225,18 @@ static void pretty_print_dev(blkid_dev dev)
mtpt[0] = 0;
retval = check_mount_point(devname, &mount_flags, mtpt, sizeof(mtpt));
if (retval == 0) {
+ const char *msg = NULL;
+
if (mount_flags & MF_MOUNTED) {
if (!mtpt[0])
- strcpy(mtpt, _("(mounted, mtpt unknown)"));
+ msg = _("(mounted, mtpt unknown)");
} else if (mount_flags & MF_BUSY)
- strcpy(mtpt, _("(in use)"));
+ msg = _("(in use)");
else
- strcpy(mtpt, _("(not mounted)"));
+ msg = _("(not mounted)");
+
+ if (msg)
+ xstrncpy(mtpt, msg, sizeof(mtpt));
}
pretty_print_line(devname, fs_type, label, mtpt, uuid);
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index c7e8d9511..1d4d24134 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -580,13 +580,19 @@ int main(int argc, char **argv)
ctl.months_in_row = MONTHS_IN_YEAR_ROW; /* default */
if (isatty(STDOUT_FILENO)) {
- int w = get_terminal_width(STDOUT_FILENO);
- int mw = ctl.julian ? DOY_MONTH_WIDTH : DOM_MONTH_WIDTH;
- int extra = ((w / mw) - 1) * ctl.gutter_width;
- int new_n = (w - extra) / mw;
+ int w, mw, extra, new_n;
+
+ w = get_terminal_width(80);
+ mw = ctl.julian ? DOY_MONTH_WIDTH : DOM_MONTH_WIDTH;
+
+ if (w < mw)
+ w = mw;
+
+ extra = ((w / mw) - 1) * ctl.gutter_width;
+ new_n = (w - extra) / mw;
if (new_n < MONTHS_IN_YEAR_ROW)
- ctl.months_in_row = new_n;
+ ctl.months_in_row = new_n > 0 ? new_n : 1;
}
} else if (!ctl.months_in_row)
ctl.months_in_row = 1;
diff --git a/misc-utils/fincore.c b/misc-utils/fincore.c
index 0fb1a759a..03ff4d154 100644
--- a/misc-utils/fincore.c
+++ b/misc-utils/fincore.c
@@ -196,7 +196,6 @@ static int fincore_fd (struct fincore_control *ctl,
size_t window_size = N_PAGES_IN_WINDOW * ctl->pagesize;
off_t file_offset, len;
int rc = 0;
- int warned_once = 0;
for (file_offset = 0; file_offset < file_size; file_offset += len) {
void *window = NULL;
@@ -207,11 +206,8 @@ static int fincore_fd (struct fincore_control *ctl,
window = mmap(window, len, PROT_NONE, MAP_PRIVATE, fd, file_offset);
if (window == MAP_FAILED) {
- if (!warned_once) {
- rc = -EINVAL;
- warn(_("failed to do mmap: %s"), name);
- warned_once = 1;
- }
+ rc = -EINVAL;
+ warn(_("failed to do mmap: %s"), name);
break;
}
diff --git a/misc-utils/findmnt-verify.c b/misc-utils/findmnt-verify.c
index 1cc62def9..132fe7fb3 100644
--- a/misc-utils/findmnt-verify.c
+++ b/misc-utils/findmnt-verify.c
@@ -97,7 +97,9 @@ static int verify_order(struct verify_context *vfy)
/* set iterator position to 'fs' */
mnt_table_set_iter(vfy->tb, itr, vfy->fs);
- mnt_table_next_fs(vfy->tb, itr, &next);
+
+ if (mnt_table_next_fs(vfy->tb, itr, &next) != 0)
+ goto done;
/* scan all next filesystems */
while (mnt_table_next_fs(vfy->tb, itr, &next) == 0) {
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index eea772f0e..06db03986 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -989,7 +989,8 @@ struct libmnt_fs *get_next_fs(struct libmnt_table *tb,
* findmnt [-l] <spec> [-O <options>] [-t <types>]
*/
again:
- mnt_table_find_next_fs(tb, itr, match_func, NULL, &fs);
+ if (mnt_table_find_next_fs(tb, itr, match_func, NULL, &fs) != 0)
+ fs = NULL;
if (!fs &&
!(flags & FL_NOSWAPMATCH) &&
diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c
index 37b8f66f6..fd9ab3f47 100644
--- a/sys-utils/lscpu-arm.c
+++ b/sys-utils/lscpu-arm.c
@@ -70,9 +70,12 @@ static const struct id_part arm_part[] = {
{ 0xd08, "Cortex-A72" },
{ 0xd09, "Cortex-A73" },
{ 0xd0a, "Cortex-A75" },
+ { 0xd0b, "Cortex-A76" },
+ { 0xd0c, "Neoverse-N1" },
{ 0xd13, "Cortex-R52" },
{ 0xd20, "Cortex-M23" },
{ 0xd21, "Cortex-M33" },
+ { 0xd4a, "Neoverse-E1" },
{ -1, "unknown" },
};
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index dd5b86cb1..f64d81836 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1929,6 +1929,8 @@ static int get_cache_full_size(struct lscpu_desc *desc,
/* Correction for CPU threads */
if (desc->nthreads > desc->ncores)
nshares /= (desc->nthreads / desc->ncores);
+ if (nshares < 1)
+ nshares = 1;
*res = (desc->ncores / nshares) * ca->size;
return 0;
@@ -2121,7 +2123,7 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
tmp = size_to_human_string(
SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE,
sz);
- snprintf(buf, sizeof(buf), _("%s cache: "), ca->name);
+ snprintf(buf, sizeof(buf), _("%s cache:"), ca->name);
add_summary_s(tb, buf, tmp);
free(tmp);
}
@@ -2139,7 +2141,7 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
tmp = size_to_human_string(
SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE,
ca->size);
- snprintf(buf, sizeof(buf), _("%s cache: "), ca->name);
+ snprintf(buf, sizeof(buf), _("%s cache:"), ca->name);
add_summary_s(tb, buf, tmp);
free(tmp);
}
@@ -2158,7 +2160,7 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
if (desc->vuls) {
for (i = 0; i < desc->nvuls; i++) {
- snprintf(buf, sizeof(buf), ("Vulnerability %s: "), desc->vuls[i].name);
+ snprintf(buf, sizeof(buf), ("Vulnerability %s:"), desc->vuls[i].name);
add_summary_s(tb, buf, desc->vuls[i].text);
}
}
diff --git a/tests/expected/lscpu/lscpu-vmware_fpe b/tests/expected/lscpu/lscpu-vmware_fpe
new file mode 100644
index 000000000..2b68db277
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-vmware_fpe
@@ -0,0 +1,76 @@
+CPU op-mode(s): 32-bit, 64-bit
+Address sizes: 48 bits physical, 48 bits virtual
+CPU(s): 16
+On-line CPU(s) list: 0-15
+Thread(s) per core: 2
+Core(s) per socket: 4
+Socket(s): 2
+NUMA node(s): 4
+Vendor ID: AuthenticAMD
+CPU family: 21
+Model: 2
+Model name: AMD Opteron(tm) Processor 6328
+Stepping: 0
+Frequency boost: enabled
+CPU MHz: 1605.776
+CPU max MHz: 3200.0000
+CPU min MHz: 1400.0000
+BogoMIPS: 6399.69
+Virtualization: AMD-V
+L1d cache: 128 KiB
+L1i cache: 512 KiB
+L2 cache: 16 MiB
+L3 cache: 24 MiB
+NUMA node0 CPU(s): 0-3
+NUMA node1 CPU(s): 4-7
+NUMA node2 CPU(s): 8-11
+NUMA node3 CPU(s): 12-15
+Vulnerability L1tf: Not affected
+Vulnerability Mds: Not affected
+Vulnerability Meltdown: Not affected
+Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
+Vulnerability Spectre v1: Mitigation; __user pointer sanitization
+Vulnerability Spectre v2: Mitigation; Full AMD retpoline, IBPB conditional, STIBP disabled, RSB filling
+Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb cpb hw_pstate ssbd ibpb vmmcall bmi1 arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
+0,0,0,0,,0,0,0,0
+1,0,0,0,,1,0,0,0
+2,1,0,0,,2,1,1,0
+3,1,0,0,,3,1,1,0
+4,2,0,1,,4,2,2,1
+5,2,0,1,,5,2,2,1
+6,3,0,1,,6,3,3,1
+7,3,0,1,,7,3,3,1
+8,4,1,2,,8,4,4,2
+9,4,1,2,,9,4,4,2
+10,5,1,2,,10,5,5,2
+11,5,1,2,,11,5,5,2
+12,6,1,3,,12,6,6,3
+13,6,1,3,,13,6,6,3
+14,7,1,3,,14,7,7,3
+15,7,1,3,,15,7,7,3
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
+0,0,0,0,,0,0,0,0
+1,1,0,0,,1,0,0,0
+2,2,0,0,,2,1,1,0
+3,3,0,0,,3,1,1,0
+4,0,0,1,,4,2,2,1
+5,1,0,1,,5,2,2,1
+6,2,0,1,,6,3,3,1
+7,3,0,1,,7,3,3,1
+8,0,1,2,,8,4,4,2
+9,1,1,2,,9,4,4,2
+10,2,1,2,,10,5,5,2
+11,3,1,2,,11,5,5,2
+12,0,1,3,,12,6,6,3
+13,1,1,3,,13,6,6,3
+14,2,1,3,,14,7,7,3
+15,3,1,3,,15,7,7,3
diff --git a/tests/expected/lscpu/lscpu-x86_64-epyc_7451 b/tests/expected/lscpu/lscpu-x86_64-epyc_7451
index e93eaf3e6..8c1b1030b 100644
--- a/tests/expected/lscpu/lscpu-x86_64-epyc_7451
+++ b/tests/expected/lscpu/lscpu-x86_64-epyc_7451
@@ -1,40 +1,40 @@
-CPU op-mode(s): 32-bit, 64-bit
-Address sizes: 48 bits physical, 48 bits virtual
-CPU(s): 96
-On-line CPU(s) list: 0-95
-Thread(s) per core: 2
-Core(s) per socket: 24
-Socket(s): 2
-NUMA node(s): 8
-Vendor ID: AuthenticAMD
-CPU family: 23
-Model: 1
-Model name: AMD EPYC 7451 24-Core Processor
-Stepping: 2
-Frequency boost: enabled
-CPU MHz: 2894.214
-CPU max MHz: 2300.0000
-CPU min MHz: 1200.0000
-BogoMIPS: 4590.83
-Virtualization: AMD-V
-L1d cache: 1.5 MiB
-L1i cache: 3 MiB
-L2 cache: 24 MiB
-L3 cache: 128 MiB
-NUMA node0 CPU(s): 0-5,48-53
-NUMA node1 CPU(s): 6-11,54-59
-NUMA node2 CPU(s): 12-17,60-65
-NUMA node3 CPU(s): 18-23,66-71
-NUMA node4 CPU(s): 24-29,72-77
-NUMA node5 CPU(s): 30-35,78-83
-NUMA node6 CPU(s): 36-41,84-89
-NUMA node7 CPU(s): 42-47,90-95
-Vulnerability L1tf: Not affected
-Vulnerability Meltdown: Not affected
-Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
-Vulnerability Spectre v1: Mitigation; __user pointer sanitization
-Vulnerability Spectre v2: Mitigation; Full AMD retpoline, IBPB conditional, STIBP disabled, RSB filling
-Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
+CPU op-mode(s): 32-bit, 64-bit
+Address sizes: 48 bits physical, 48 bits virtual
+CPU(s): 96
+On-line CPU(s) list: 0-95
+Thread(s) per core: 2
+Core(s) per socket: 24
+Socket(s): 2
+NUMA node(s): 8
+Vendor ID: AuthenticAMD
+CPU family: 23
+Model: 1
+Model name: AMD EPYC 7451 24-Core Processor
+Stepping: 2
+Frequency boost: enabled
+CPU MHz: 2894.214
+CPU max MHz: 2300.0000
+CPU min MHz: 1200.0000
+BogoMIPS: 4590.83
+Virtualization: AMD-V
+L1d cache: 1.5 MiB
+L1i cache: 3 MiB
+L2 cache: 24 MiB
+L3 cache: 128 MiB
+NUMA node0 CPU(s): 0-5,48-53
+NUMA node1 CPU(s): 6-11,54-59
+NUMA node2 CPU(s): 12-17,60-65
+NUMA node3 CPU(s): 18-23,66-71
+NUMA node4 CPU(s): 24-29,72-77
+NUMA node5 CPU(s): 30-35,78-83
+NUMA node6 CPU(s): 36-41,84-89
+NUMA node7 CPU(s): 42-47,90-95
+Vulnerability L1tf: Not affected
+Vulnerability Meltdown: Not affected
+Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
+Vulnerability Spectre v1: Mitigation; __user pointer sanitization
+Vulnerability Spectre v2: Mitigation; Full AMD retpoline, IBPB conditional, STIBP disabled, RSB filling
+Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/ts/lscpu/dumps/vmware_fpe.tar.gz b/tests/ts/lscpu/dumps/vmware_fpe.tar.gz
new file mode 100644
index 000000000..1fc6aed4a
--- /dev/null
+++ b/tests/ts/lscpu/dumps/vmware_fpe.tar.gz
Binary files differ