* [PATCH v4 0/2] bsearch: fix overflow and avoid unnecessary calculation
@ 2009-11-10 15:00 André Goddard Rosa
0 siblings, 0 replies; only message in thread
From: André Goddard Rosa @ 2009-11-10 15:00 UTC (permalink / raw)
To: tabbott, alan-jenkins, rusty, linux-kernel; +Cc: André Goddard Rosa
Fix a rare overflow situation which can occur when working with large arrays.
Also, remove an unneeded calculation.
changelog:
v4: fix the overflow which could still happen when the number of array
elements to search approached the maximum value of size_t and to
find the key element we would need to traverse the whole binary tree
(making 'start' idx tend towards 'end' idx), as pointed by review
feedback from Rusty Russell (thanks!)
v3: fix the comment/example of patch 02/02 at v2 patch series
v2: fix a bug introduced into 01/02 of the v1 patch series
v1: initial submission
André Goddard Rosa (2):
bsearch: avoid unneeded decrement arithmetic
bsearch: prevent overflow when computing middle comparison element
lib/bsearch.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-11-11 15:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 15:00 [PATCH v4 0/2] bsearch: fix overflow and avoid unnecessary calculation André Goddard Rosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox