From patchwork Wed Jun 29 11:59:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 71185 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2107786qgy; Wed, 29 Jun 2016 05:00:40 -0700 (PDT) X-Received: by 10.37.223.5 with SMTP id w5mr2717049ybg.139.1467201640170; Wed, 29 Jun 2016 05:00:40 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e7si2777755qkf.72.2016.06.29.05.00.39; Wed, 29 Jun 2016 05:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BF02C6745A; Wed, 29 Jun 2016 12:00:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0F8906745C; Wed, 29 Jun 2016 11:59:55 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BE2E16745A; Wed, 29 Jun 2016 11:59:51 +0000 (UTC) Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by lists.linaro.org (Postfix) with ESMTPS id C252F67455 for ; Wed, 29 Jun 2016 11:59:50 +0000 (UTC) Received: by mail-ob0-f179.google.com with SMTP id mu6so21975315obc.3 for ; Wed, 29 Jun 2016 04:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wv6XVImGZvTi9TGJGUtxLUufy2KULktx+gDcoxGErbY=; b=Hb2783IMi5/+M9/C/n3fJvn1a/Mda2rsXGjX8X+uPodfpfJwhA6mvfiDDoOEv0cfGg Qyf9GQXfpAmJmmAJriLyGd2FuR/ntkG7LcEns6MQQr087zzo38dTxd4wpyxqrdGLIcGF rWfRRF7Icc2mkew2giIdHawi0YXaKy6MAbys2/MxIJydqYOyyRqvdM80UV+8ud9Vh+FT 94NvALAlaFKOeQP9FTw9UUMRXXacT5DgZ/ompYuJep2v51gED2ssM3tIqYn2uTAeD9FY zd3xBZSjoNl7y+DuBTGSKxSfBqtD+iU5Roq7ELPRgHelCnzWOqMDXa80mglTuw9kV06I CItg== X-Gm-Message-State: ALyK8tIg27FNALpUPmXs017B5vSf7RQ4MHjqTplsN7RnH1Feg6/l7AWIRPgsyR+rbsLEhZBOiu4= X-Received: by 10.202.106.194 with SMTP id f185mr5278230oic.50.1467201590263; Wed, 29 Jun 2016 04:59:50 -0700 (PDT) Received: from localhost.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id m80sm1248365oik.6.2016.06.29.04.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jun 2016 04:59:49 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 29 Jun 2016 06:59:42 -0500 Message-Id: <1467201583-4892-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467201583-4892-1-git-send-email-bill.fischofer@linaro.org> References: <1467201583-4892-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 1/2] validation: queue: use signed vars to avoid out of bounds references X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The variables i and num_queues must be int32_t rather than uint32_t to avoid a potential loop overrun in the event that the initial odp_queue_create() for i = 0 fails. In this case num_queues is set to -1, but since it is uint32_t it is interpreted as a very large positive number. Signed-off-by: Bill Fischofer --- test/validation/queue/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index be9c0dc..d88e74b 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -56,7 +56,7 @@ void queue_test_capa(void) odp_queue_param_t qparams; char name[ODP_QUEUE_NAME_LEN]; odp_queue_t queue[MAX_QUEUES]; - uint32_t num_queues, i; + int32_t num_queues, i; memset(&capa, 0, sizeof(odp_queue_capability_t)); CU_ASSERT(odp_queue_capability(&capa) == 0);