From 1b38b751ff09d53641eb5851374461114ee2e9b2 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 1 Sep 2015 00:00:00 -0500 Subject: [PATCH] library: more miscellaneous pids implementation tweaks A patch containing the following miscellaneous tweaks: . make a supposedly robust parameter test truly robust [ ensure the largest enum value used with validation ] . remove duplicate item test in cleanup_stack function [ is already subordinate to test of PROCPS_PIDS_noop ] Signed-off-by: Jim Warner --- proc/pids.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/proc/pids.c b/proc/pids.c index 54432ccc..16eac33a 100644 --- a/proc/pids.c +++ b/proc/pids.c @@ -739,8 +739,7 @@ static inline void cleanup_stack ( if (p->item < PROCPS_PIDS_noop) { if (Item_table[p->item].freefunc) Item_table[p->item].freefunc(p); - if (p->item < PROCPS_PIDS_noop) - p->result.ull_int = 0; + p->result.ull_int = 0; } ++p; } @@ -802,7 +801,7 @@ static inline int items_check_failed ( * ^~~~~~~~~~~~~~~~ */ if (maxitems < 1 - || (void *)items < (void *)PROCPS_PIDS_physical_end) + || (void *)items < (void *)0x8000) // twice as big as our largest enum return -1; for (i = 0; i < maxitems; i++) { // a pids_item is currently unsigned, but we'll protect our future