linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Zephaniah E. Loss-Cutler-Hull" <zephaniah@gmail.com>,
	Len Brown <len.brown@intel.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.19 49/52] tools/power x86_energy_perf_policy: Fix argument parsing
Date: Wed,  4 Sep 2019 12:00:01 -0400	[thread overview]
Message-ID: <20190904160004.3671-49-sashal@kernel.org> (raw)
In-Reply-To: <20190904160004.3671-1-sashal@kernel.org>

From: "Zephaniah E. Loss-Cutler-Hull" <zephaniah@gmail.com>

[ Upstream commit 03531482402a2bc4ab93cf6dde46833775e035e9 ]

The -w argument in x86_energy_perf_policy currently triggers an
unconditional segfault.

This is because the argument string reads: "+a:c:dD:E:e:f:m:M:rt:u:vw" and
yet the argument handler expects an argument.

When parse_optarg_string is called with a null argument, we then proceed to
crash in strncmp, not horribly friendly.

The man page describes -w as taking an argument, the long form
(--hwp-window) is correctly marked as taking a required argument, and the
code expects it.

As such, this patch simply marks the short form (-w) as requiring an
argument.

Signed-off-by: Zephaniah E. Loss-Cutler-Hull <zephaniah@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
index bbef8bcf44d6d..2aba622d1c5aa 100644
--- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
+++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
@@ -546,7 +546,7 @@ void cmdline(int argc, char **argv)
 
 	progname = argv[0];
 
-	while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw",
+	while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw:",
 				long_options, &option_index)) != -1) {
 		switch (opt) {
 		case 'a':
-- 
2.20.1


  parent reply	other threads:[~2019-09-04 16:01 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 15:59 [PATCH AUTOSEL 4.19 01/52] ieee802154: hwsim: Fix error handle path in hwsim_init_module Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 02/52] ieee802154: hwsim: unregister hw while hwsim_subscribe_all_others fails Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 03/52] ARM: dts: am57xx: Disable voltage switching for SD card Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 04/52] ARM: OMAP2+: Fix missing SYSC_HAS_RESET_STATUS for dra7 epwmss Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 05/52] bus: ti-sysc: Fix using configured sysc mask value Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 06/52] s390/bpf: fix lcgr instruction encoding Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 07/52] ARM: OMAP2+: Fix omap4 errata warning on other SoCs Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 08/52] ARM: dts: dra74x: Fix iodelay configuration for mmc3 Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 09/52] ARM: OMAP1: ams-delta-fiq: Fix missing irq_ack Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 10/52] bus: ti-sysc: Simplify cleanup upon failures in sysc_probe() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 11/52] s390/bpf: use 32-bit index for tail calls Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 12/52] batman-adv: fix uninit-value in batadv_netlink_get_ifindex() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 13/52] selftests/bpf: fix "bind{4, 6} deny specific IP & port" on s390 Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 14/52] tools: bpftool: close prog FD before exit on showing a single program Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 15/52] fpga: altera-ps-spi: Fix getting of optional confd gpio Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 16/52] netfilter: ebtables: Fix argument order to ADD_COUNTER Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 17/52] netfilter: nft_flow_offload: missing netlink attribute policy Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 18/52] netfilter: xt_nfacct: Fix alignment mismatch in xt_nfacct_match_info Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 19/52] NFSv4: Fix return values for nfs4_file_open() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 20/52] NFSv4: Fix return value in nfs_finish_open() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 21/52] NFS: Fix initialisation of I/O result struct in nfs_pgio_rpcsetup Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 22/52] Kconfig: Fix the reference to the IDT77105 Phy driver in the description of ATM_NICSTAR_USE_IDT77105 Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 23/52] xdp: unpin xdp umem pages in error path Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 24/52] qed: Add cleanup in qed_slowpath_start() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 25/52] ARM: 8874/1: mm: only adjust sections of valid mm structures Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 26/52] batman-adv: Only read OGM tvlv_len after buffer len check Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 27/52] batman-adv: Only read OGM2 " Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 28/52] bpf: allow narrow loads of some sk_reuseport_md fields with offset > 0 Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 29/52] r8152: Set memory to all 0xFFs on failed reg reads Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 30/52] x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 31/52] netfilter: xt_physdev: Fix spurious error message in physdev_mt_check Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 32/52] netfilter: nf_conntrack_ftp: Fix debug output Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 33/52] NFSv2: Fix eof handling Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 34/52] NFSv2: Fix write regression Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 35/52] kallsyms: Don't let kallsyms_lookup_size_offset() fail on retrieving the first symbol Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 36/52] cifs: set domainName when a domain-key is used in multiuser Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 37/52] cifs: Use kzfree() to zero out the password Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 38/52] x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 39/52] usb: host: xhci-tegra: Set DMA mask correctly Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 40/52] ARM: 8901/1: add a criteria for pfn_valid of arm Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 41/52] ibmvnic: Do not process reset during or after device removal Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 42/52] sky2: Disable MSI on yet another ASUS boards (P6Xxxx) Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 43/52] i2c: designware: Synchronize IRQs when unregistering slave client Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 44/52] perf/x86/intel: Restrict period on Nehalem Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 45/52] perf/x86/amd/ibs: Fix sample bias for dispatched micro-ops Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 46/52] amd-xgbe: Fix error path in xgbe_mod_init() Sasha Levin
2019-09-04 15:59 ` [PATCH AUTOSEL 4.19 47/52] net: stmmac: dwmac-rk: Don't fail if phy regulator is absent Sasha Levin
2019-09-04 16:00 ` [PATCH AUTOSEL 4.19 48/52] tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2 Sasha Levin
2019-09-04 16:00 ` Sasha Levin [this message]
2019-09-04 16:00 ` [PATCH AUTOSEL 4.19 50/52] tools/power turbostat: fix buffer overrun Sasha Levin
2019-09-04 16:00 ` [PATCH AUTOSEL 4.19 51/52] net: aquantia: fix out of memory condition on rx side Sasha Levin
2019-09-04 16:00 ` [PATCH AUTOSEL 4.19 52/52] net: seeq: Fix the function used to release some memory in an error handling path Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904160004.3671-49-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zephaniah@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).