From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9DBC3A0352; Mon, 4 Nov 2019 15:33:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9E253772; Mon, 4 Nov 2019 15:33:11 +0100 (CET) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 499BD374E for ; Mon, 4 Nov 2019 15:33:11 +0100 (CET) Received: by mail-lj1-f194.google.com with SMTP id n5so6838263ljc.9 for ; Mon, 04 Nov 2019 06:33:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=sLuxRt+74B9drDHrZsQeFwSdSwKrAxjJan41lO6xWEU=; b=fCyEBkbueTPMwx//Q+cIpMWMgByIXutyvTmy9GEfcSTgfywL8RmI9tNRZKKweAkmrY KaTgbkzLB8TJgxMF43SmW70ary35MGJ8/4PAENS/iLOc7QNW6AvQ4JyzJUnmpw5Eq8ri 6tWKl+wddRZtvzpxtVKr10FAaq1zYiZ/nNXfVW/aErfwFjMGEGFQFTpYC8+J4gYIXX6p IND7dDlNOEah7u/pyv5kvpfg61xIIJ5OFkZVlYc4ZcGGlcMOY3wAZUMDRKmq/boretNK nVH35ig6Sm0ooxmvbnaaNSd3vO+vbVT1sofI7q6hDmksm0z8jo4pN8lHfPLsFrSd7SjZ VY3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sLuxRt+74B9drDHrZsQeFwSdSwKrAxjJan41lO6xWEU=; b=naS2IWNoe059KUoZBZEP8t5oJ0VHA5E6oc+o70Dv0xg1zMvOSBzkxv4OqOul5RoneL NznKCCwgp8bgsP4unNrWkm7i7lanvhZWisL+RzA1phi/Sc28BZlcG+UGZxQ3XWw0bKFX 8YRL1WrdpCJwi8YxR1AjqE8+Ga0XqCTP80298dBj+SKb2i6GataoxsYoFNqiF9dI91B+ ZiR4TAitFxnMm5C2SR0+VFjnHhJ8fSgRqGm3nDzBit95MEpgYKBfExIlP4jy58oCVWo2 7O/E8DhlEwWnfGkKdHobbND5R69G0CwkqueTvyMw3zm3GijtoAIwrdlQFqssupR5WkGr cpww== X-Gm-Message-State: APjAAAVpjNDtNCemtdJukOR1Sm9ErgzQVjZURdPgNKPmriMGXhmgJ5uI JW/uRs2wZXBSpAT8TuWycnKVbg== X-Google-Smtp-Source: APXvYqxoVXal19Mel67UUC4tOmdgRQwewudvXapx34JadU/tg+0VYhLY4cLEWAvgDXaxZPw87xDo/g== X-Received: by 2002:a2e:92c4:: with SMTP id k4mr18998886ljh.10.1572877990195; Mon, 04 Nov 2019 06:33:10 -0800 (PST) Received: from [10.0.0.72] (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id v12sm7522239ljg.14.2019.11.04.06.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Nov 2019 06:33:09 -0800 (PST) To: Hemant Agrawal , "dev@dpdk.org" , Sachin Saxena Cc: "mattias.ronnblom@ericsson.com" , "stephen@networkplumber.org" References: <20191028142145.3758-1-aostruszka@marvell.com> <20191029141212.4907-1-aostruszka@marvell.com> <20191029141212.4907-9-aostruszka@marvell.com> From: Andrzej Ostruszka Message-ID: <46b895f4-cdf7-dca5-3d6b-88a8ec25bff9@semihalf.com> Date: Mon, 4 Nov 2019 15:33:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 08/12] net/dpaa2: fix possible use of uninitialized vars X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/4/19 12:46 PM, Hemant Agrawal wrote: > Hi Andrzej Hello Hemant, Thank you for your comments. >> -----Original Message----- >> From: Andrzej Ostruszka [...] >> a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c index >> 80f94f40e..7aa63ea12 100644 >> --- a/drivers/net/dpaa2/mc/dpkg.c >> +++ b/drivers/net/dpaa2/mc/dpkg.c >> @@ -63,7 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg >> *cfg, uint8_t *key_cfg_buf) >> dpkg_set_field(extr->extract_type, EXTRACT_TYPE, >> cfg->extracts[i].type); >> > [Hemant] Please add a check here to avoid array overrun > + if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS) > + return -EINVAL; > + Will do, thank you. >> - for (j = 0; j < DPKG_NUM_OF_MASKS; j++) { >> + for (j = 0; j < extr->num_of_byte_masks; j++) { >> extr->masks[j].mask = cfg- >>> extracts[i].masks[j].mask; >> extr->masks[j].offset = >> cfg->extracts[i].masks[j].offset; >> diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c >> index 0950ee007..89a64b0ab 100644 >> --- a/drivers/net/dpaa2/mc/dpni.c >> +++ b/drivers/net/dpaa2/mc/dpni.c >> @@ -1839,10 +1839,13 @@ int dpni_set_congestion_notification(struct >> fsl_mc_io *mc_io, >> cmd_params->qtype = qtype; >> cmd_params->tc = tc_id; >> cmd_params->congestion_point = cfg->cg_point; >> - cmd_params->cgid = (uint8_t)cfg->cgid; >> - cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id); >> + if (cfg->cg_point == DPNI_CP_CONGESTION_GROUP) >> + cmd_params->cgid = (uint8_t)cfg->cgid; >> + if (cfg->dest_cfg.dest_type != DPNI_DEST_NONE) { >> + cmd_params->dest_id = cpu_to_le32(cfg- >>> dest_cfg.dest_id); >> + cmd_params->dest_priority = cfg->dest_cfg.priority; >> + } > [Hemant] What is the explicit error you got here? > In the calling function, we are resetting the structure to 0. Which should have avoided > Any un-initialized var errors? > struct dpni_congestion_notification_cfg cong_notif_cfg = {0}; Indeed there is no warning from compiler here at the current version. The original version was developed against 18.05 and this is what I used to make compiler happy. I've kept this change (even though compiler does not report anything here) since to me it looked like a good change (use the cgid only in case of "congestion group" and use dest_* only when not DEST_NONE). You have obviously more authority here so I will remove these changes (unless you prefer them to stay - in which case please indicate so). Again thank you for the comments. Regards Andrzej