diff --git a/powertop-segfault.diff b/powertop-segfault.diff new file mode 100644 index 0000000..71b22ff --- /dev/null +++ b/powertop-segfault.diff @@ -0,0 +1,20 @@ +--- config.c ++++ config.c +@@ -33,7 +33,7 @@ + #include "powertop.h" + + /* static arrays are not nice programming.. but they're easy */ +-static char configlines[5000][100]; ++static char configlines[8000][100]; + static int configcount; + + static void read_kernel_config(void) +@@ -45,7 +45,7 @@ + return; + if (access("/proc/config.gz", R_OK) == 0) { + file = popen("zcat /proc/config.gz 2> /dev/null", "r"); +- while (file && !feof(file)) { ++ while (file && !feof(file) && configcount < 7999) { + char line[100]; + if (fgets(line, 100, file) == NULL) + break; diff --git a/powertop.changes b/powertop.changes index 0a844ed..7ec89fe 100644 --- a/powertop.changes +++ b/powertop.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 9 01:18:56 CET 2010 - ro@suse.de + +- fix segfault: increase max lines from 5000 to 8000 for + /proc/config.gz and abort if reaching limit + ------------------------------------------------------------------- Wed Mar 4 00:44:47 CET 2009 - ro@suse.de diff --git a/powertop.spec b/powertop.spec index c88d653..71efbee 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,7 +1,7 @@ # # spec file for package powertop (Version 1.11) # -# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,10 +21,11 @@ Name: powertop Url: http://www.linuxpowertop.org Summary: PowerTOP is a Linux Tool to Find out What is Using Power on a Laptop Version: 1.11 -Release: 1 -License: GPL v2 or later +Release: 2 +License: GPLv2+ Group: System/Monitoring Source0: %{name}-%{version}.tar.gz +Patch0: powertop-segfault.diff BuildRequires: ncurses-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReqProv: on @@ -42,6 +43,7 @@ Authors: %prep %setup +%patch0 %build make CFLAGS="$RPM_OPT_FLAGS" @@ -61,126 +63,3 @@ rm -rf %{_buildroot} %{_mandir}/man*/%{name}.1.gz %changelog -* Wed Mar 04 2009 ro@suse.de -- Update to PowerTOP 1.11 -- Changes: - * Fix compilation with PIC - * polling hint now refers to /dev/cdrom instead of /dev/scd0 - * fix calculations for systems that vary in power draw proc info - * Display mwait usage - * fix EOF at input - * add --version|-v option - * spelling error in tips. -* Mon Jun 16 2008 thoenig@suse.de -- Update to PowerTOP 1.10 -- Changes: - * USB suspend statistics - * support for iwl4965 power saving - * Powertop now reports which C-states are supported by CPU/BIOS - * Updated translations: ja, pt_BR, hu, id, zh (thanks!) -* Wed Nov 07 2007 thoenig@suse.de -- Update to PowerTOP 1.9 -- Changes: - * add support for mac80211 based wireless power saving - * improve bluetooth inactivity detection - * report USB activity (needs 2.6.24-rc kernel) - * support the newly reported interrupt events in 2.6.24-rc -* Wed Oct 10 2007 thoenig@suse.de -- Update to PowerTOP 1.8 -- Changes: - * add suggestion to increase VM writeback timeout - * add suggestion to enable INOTIFY in the kernel - * fix socket fd leak, found by Nikerabbit on #powertop - * Add support for deferrable timers (Scott Lamb) - * Add active hint to enable USB autosuspend on Fedora 7 - * Show blue color if the cpu is 25%% or more busy to indicate - that idle wakeups no longer is the nr 1 power causer - (Santiago Gala) - * merge the -d option from Bill Nottingham (Fedora) to allow - automated collection of data -* Mon Jun 18 2007 thoenig@suse.de -- Update to PowerTOP 1.7 -- Changes: - * add suggestion to disable TV out - * add suggestion to disable Wake-On-Lan for unused ethernet - * show P-states (frequencies) -* Sun Jun 10 2007 thoenig@suse.de -- Update to PowerTOP 1.6 -- Changes: - * Add suggestion to rf_kill unused wireless interfaces - * Propose killing "sealert"; this is a new thing in F7 that wakes - up 10 times per second for no reason - * avoid showing the laptop mode hint when on AC - Val Henson - * suggest enabling noatime to save disk IO's - * suggest enabling SATA AHCI Link powermanagement - * suggest enabling the SMP Power Aware Scheduler -* Mon May 28 2007 thoenig@suse.de -- Update to PowerTOP 1.5 -- Changes: - * fix resize-corrupts-screen-content bug - * add interrupts to the wakeups/second data in the emulated - (non-mobile) case - * calculate a long term power usage from battery charge deltas; - this should help people whos battery doesn't report discharge - rates, and also will provide a less noisy datapoint - * Add option to use `kill` on some known power hogs if they are - actually waking up a lot: - - beagle (even latest wakes up 10 times/second when not - indexing) - - hal (suggest to stop cdrom polling) - - gnome-power-manager - These only show if these actually wake up the cpu 'a lot'; - so if these get fixed then the suggestion will not display. -* Sat May 26 2007 schwab@suse.de -- Don't strip binaries. -* Sat May 26 2007 thoenig@suse.de -- Update to PowerTOP 1.4 -- Strip binary -- Add man page and localisation for powertop -- Changes: - * use gettext to allow translation - (with lots of thanks to the various translators, especially - to Benjamin Pineau who showed me how to use gettext tools) - * fix bluethooth-checks-cause-autload-of-bluetooth bug - * use ncurses (Sebastian Kuzminsky) - * rotate through the suggestions randomly, so that all of them - will show over time - * Fix the CONFIG_SND_AC97_POWER_SAVE check to only report on ac97 - hw - * report "hidden but suprious" timer ticks (due to missing hpet - or lack of NO_HZ) - * check for HPET being present; if not suggest user to toggle in - BIOS or apply the patch - * Some suggestions have become "active", you can press a key to - tune it right away. - * Add active suggestion to enable AC97 powersave mode at runtime - * Add active suggestion to enable wireless powersave mode at - runtime - * Add active suggestion to enable ondemand -* Tue May 22 2007 thoenig@suse.de -- Update to PowerTOP 1.3 -- Remove patch powertop-fix-compiler-warnings-thoenig-02.patch: - merged upstream -- Changes: - * Add suggestion for CONFIG_SND_AC97_POWER_SAVE - * Fix inefficient code for readdir (Vince Pinter) - * Highlight the worst offenders in bold (Vince Pinter) - * Fix crash when running on 2.4 kernels (Harald Fernengel) - * Check fgets() return values (Timom Hoenig @ SuSE) - * add suggestion to enable laptop mode (when disabled) - * add suggestion to disable bluetooth when unused -* Tue May 15 2007 thoenig@suse.de -- Update to PowerTOP 1.2 (skipped 1.1) -- Fix battery code to work with both, mA and mW -- Clean up spec file -- Update patch powertop-fix-compiler-warnings-thoenig-02.patch -- Drop patch powertop-respect-rpm-opt-flags-thoenig-01.patch -* Sun May 13 2007 thoenig@suse.de -- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make - compiler warnings about unsued parameters and return values not - being repected go away. -- Fix whitespaces for %%description -* Sun May 13 2007 thoenig@suse.de -- Initial package submission (PowerTOP 1.0) -- Add patch powertop-respect-rpm-opt-flags-thoenig-01.patch: Fix - Makefile to respect RPM_OPT_FLAGS