Re: [PATCH]: double free in trace extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> So then the code should just recognize that the "cpu" value
> is beyond the architecture's maximum array index, report the
> inconsistency, and "continue" on to the next map?
>

Well, that's more or less exactly what I did. See attached patch.

/Per

> Dave
>
>
> --
> Crash-utility mailing list
> Crash-utility@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/crash-utility
diff --git a/kernel.c b/kernel.c
index 4342bce..9e33e56 100755
--- a/kernel.c
+++ b/kernel.c
@@ -703,6 +703,11 @@ cpu_maps_init(void)
 			for (c = 0; c < BITS_PER_LONG; c++)
 				if (*maskptr & (0x1UL << c)) {
 					cpu = (i * BITS_PER_LONG) + c;
+					if (cpu >= NR_CPUS) {
+						error(WARNING, "Mask indicates too many %s cpus\n",
+						      mapinfo[m].name);
+						break;
+					}
 					kt->cpu_flags[cpu] |= mapinfo[m].cpu_flag;
 				}
 		}
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux