From c7961ee4953dbcc8c45790d3c92fe3172e924f47 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 27 Jan 2014 17:34:31 +0100 Subject: [PATCH] dbwrap: completely check validity of lock order in dbwrap_check_lock_order() This is currently not strictly necessay, because the only caller catches the DBWRAP_LOCK_ORDER_NONE case, and maximum is already checked, but this seems too dangerous to me. Use the new DBWRAP_LOCK_ORDER_VALID() macro. Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher --- lib/dbwrap/dbwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index 3606617e2e8..d75c714ef1f 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -167,7 +167,7 @@ static struct dbwrap_lock_order_state *dbwrap_check_lock_order( static struct db_context *locked_dbs[DBWRAP_LOCK_ORDER_MAX]; struct dbwrap_lock_order_state *state = NULL; - if (db->lock_order > DBWRAP_LOCK_ORDER_MAX) { + if (!DBWRAP_LOCK_ORDER_VALID(db->lock_order)) { DEBUG(0,("Invalid lock order %d of %s\n", (int)db->lock_order, db->name)); smb_panic("invalid lock_order\n"); -- 2.11.4.GIT