lkml.org 
[lkml]   [2009]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names
On Thu, Aug 06, 2009 at 03:21:55PM +0300, Ozan Çağlayan wrote:
>When EIP is at a module having an underscore in its name, the current
>code fails to find it because the module filenames has '-' instead of
>'_'.
>
>Use modinfo to correctly get the full path to the module.
>
>Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
>---
>This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than
>searching through the filesystem but may not be desirable as it brings a dependency
>to module-init-tools. Replacing underscore occurences by '-' can be another solution.
>
> scripts/markup_oops.pl | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
>diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
>index 8977401..bc14f4c 100644
>--- a/scripts/markup_oops.pl
>+++ b/scripts/markup_oops.pl
>@@ -184,10 +184,7 @@ if ($target eq "0") {
>
> # if it's a module, we need to find the .ko file and calculate a load offset
> if ($module ne "") {
>- my $dir = dirname($filename);
>- $dir = $dir . "/";
>- my $mod = $module . ".ko";
>- my $modulefile = `find $dir -name $mod | head -1`;
>+ my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`;


I know this works, but how about grep '^filename:' ? This is more strict.

Also, although on most Linux awk is just a symbol link to gawk,
but it is still better to use awk instead of gawk for portability reason.


> chomp($modulefile);
> $filename = $modulefile;
> if ($filename eq "") {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-08-07 03:43    [W:0.067 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site