Hey, I would like to close one important bug in powertop, which affects the usage on newer kernels (e.g. 2.6.37), as powertop will segfault on such kernels due to too small buffer (see #610101). Please see my attached patch for powertop 1.11-1+squeeze1 Greetings Winnie
diff -u powertop-1.11/debian/changelog powertop-1.11/debian/changelog --- powertop-1.11/debian/changelog +++ powertop-1.11/debian/changelog @@ -1,3 +1,10 @@ +powertop (1.11-1+squeeze1) stable; urgency=low + + * Fix segfault on newer kernels with large config files. + Thanks to Mel Gorman (Closes: #610101) + + -- Patrick Winnertz <winnie@debian.org> Fri, 11 Mar 2011 11:22:33 +0100 + powertop (1.11-1) unstable; urgency=low * New upstream release diff -u powertop-1.11/debian/patches/00list powertop-1.11/debian/patches/00list --- powertop-1.11/debian/patches/00list +++ powertop-1.11/debian/patches/00list @@ -1,0 +2 @@ +increase-configlimit.dpatch only in patch2: unchanged: --- powertop-1.11.orig/debian/patches/increase-configlimit.dpatch +++ powertop-1.11/debian/patches/increase-configlimit.dpatch @@ -0,0 +1,38 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## increase-configlimit.patch.dpatch by <mel@csn.ul.ie> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' powertop-1.11~/config.c powertop-1.11/config.c +--- powertop-1.11~/config.c 2011-01-15 11:51:23.000000000 +0000 ++++ powertop-1.11/config.c 2011-01-15 11:58:55.494107143 +0000 +@@ -33,7 +33,8 @@ + #include "powertop.h" + + /* static arrays are not nice programming.. but they're easy */ +-static char configlines[5000][100]; ++#define MAXCONFIGLINES 10000 ++static char configlines[MAXCONFIGLINES][100]; + static int configcount; + + static void read_kernel_config(void) +@@ -49,6 +50,8 @@ + char line[100]; + if (fgets(line, 100, file) == NULL) + break; ++ if (configcount >= MAXCONFIGLINES) ++ break; + strcpy(configlines[configcount++], line); + } + pclose(file); +@@ -77,6 +80,8 @@ + char line[100]; + if (fgets(line, 100, file) == NULL) + break; ++ if (configcount >= MAXCONFIGLINES) ++ break; + strcpy(configlines[configcount++], line); + } + fclose(file);
Attachment:
signature.asc
Description: This is a digitally signed message part.