From patchwork Fri Mar 20 22:10:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 6061291 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AFFB2BF90F for ; Fri, 20 Mar 2015 22:10:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5C4C20515 for ; Fri, 20 Mar 2015 22:10:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 34E39204E3 for ; Fri, 20 Mar 2015 22:10:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6EDE6E3B6; Fri, 20 Mar 2015 15:10:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f170.google.com (mail-qc0-f170.google.com [209.85.216.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E4B86E3C2 for ; Fri, 20 Mar 2015 15:10:30 -0700 (PDT) Received: by qcay5 with SMTP id y5so14943296qca.1 for ; Fri, 20 Mar 2015 15:10:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=1F90OhnhUY9G/OMwQHb7UY5aaeu+veEY1igEcnL40W8=; b=LdGRH5QmykSXKNYFaLuKwfsM3sOYRGonUlczbcj8ZFNQx6oL9d940yy4/CLA6wbHQ7 BUbvUcPwqay4WPfZ3QFF5+p2RnNVHodauP/8KQoQpfxuT3wgVkOKJflNBodt2hMWVC5k AFDZcFqrKSGMRCaxC0DlI7abr3EnHz3fvDIU5tQquDCpQFx+csh79alQcrGDbUB7ttY5 yZccPYqReHkoN3s3mJqkV/lHUqDVeMKrHioOB6nD7GqR2A2i00/3V4vzNKb/ReoNVbks jKP3uXnXfgAVhBzYxhBv8idgysFHFI3NT6JCp/ePMoKZailllxSZao6PDJd5MTfHnq+1 XJug== X-Gm-Message-State: ALoCoQkeANQhojXVfq86f95h2Py31BB9IHZNEroh8MatOSMoVXPMg+I+xsTft1PtBwZMtsP2CYXr X-Received: by 10.229.227.71 with SMTP id iz7mr51035237qcb.0.1426889429957; Fri, 20 Mar 2015 15:10:29 -0700 (PDT) Received: from adriatix.rutgers.edu ([198.151.130.140]) by mx.google.com with ESMTPSA id b69sm3928946qka.11.2015.03.20.15.10.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 15:10:29 -0700 (PDT) From: Jan Vesely To: dri-devel@lists.freedesktop.org, Emil Velikov Subject: [PATCH libdrm 1/4] drmSL: Fix neighbor printing Date: Fri, 20 Mar 2015 18:10:25 -0400 Message-Id: <1426889428-4847-1-git-send-email-jan.vesely@rutgers.edu> X-Mailer: git-send-email 2.1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v2: zero the update array instead of checking the return value. SLLocate returns NULL both on failure and if the element is greater than everything in the list Signed-off-by: Jan Vesely Acked-by: Emil Velikov --- xf86drmSL.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xf86drmSL.c b/xf86drmSL.c index acddb54..cf588ac 100644 --- a/xf86drmSL.c +++ b/xf86drmSL.c @@ -264,12 +264,14 @@ int drmSLLookupNeighbors(void *l, unsigned long key, unsigned long *next_key, void **next_value) { SkipListPtr list = (SkipListPtr)l; - SLEntryPtr update[SL_MAX_LEVEL + 1]; + SLEntryPtr update[SL_MAX_LEVEL + 1] = {0}; int retcode = 0; + SLLocate(list, key, update); + *prev_key = *next_key = key; *prev_value = *next_value = NULL; - + if (update[0]) { *prev_key = update[0]->key; *prev_value = update[0]->value;