summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-14 14:39:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-05-14 14:39:13 +0200
commit8978c64d55e470bdc89523561bdc12a9e71183a9 (patch)
tree85ee2838df6b4ca2e4df0a6ee0cd68c5ab996f4b
parentec49d131847ccd6a4e1bf4d7b98c6a2999052efd (diff)
downloadabrt-8978c64d55e470bdc89523561bdc12a9e71183a9.tar.gz
abrt-8978c64d55e470bdc89523561bdc12a9e71183a9.tar.xz
abrt-8978c64d55e470bdc89523561bdc12a9e71183a9.zip
improve kerneloops hash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/Plugins/Kerneloops.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp
index 413e1912..69f6a9a5 100644
--- a/lib/Plugins/Kerneloops.cpp
+++ b/lib/Plugins/Kerneloops.cpp
@@ -28,8 +28,26 @@ static unsigned hash_oops_str(const char *oops_ptr)
unsigned char old_c;
unsigned char c = 0;
unsigned hash = 0;
- while (1)
- {
+
+ /* Special-case: if the first line is of form:
+ * WARNING: at net/wireless/core.c:614 wdev_cleanup_work+0xe9/0x120 [cfg80211]() (Not tainted)
+ * then hash only "file:line func+ofs/len" part.
+ */
+ if (strncmp(oops_ptr, "WARNING: at ", sizeof("WARNING: at ")-1) == 0) {
+ const char *p = oops_ptr + sizeof("WARNING: at ")-1;
+ p = strchr(p, ' '); /* skip filename:NNN */
+ if (p) {
+ p = strchrnul(p + 1, ' '); /* skip function_name+0xNN/0xNNN */
+ oops_ptr += sizeof("WARNING: at ")-1;
+ while (oops_ptr < p) {
+ c = *oops_ptr++;
+ hash = ((hash << 5) ^ (hash >> 27)) ^ c;
+ }
+ return hash;
+ }
+ }
+
+ while (1) {
old_c = c;
c = *oops_ptr++;
if (!c)