From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-106.mta0.migadu.com [91.218.175.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF335476065 for ; Tue, 1 Sep 2026 09:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.106 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788253491; cv=none; b=OgVpDLK2nTFn4OdCnJ+K0NkpLy970zluww4EnpWwm+MM2e/K1tOL2hjWvHZNelbdo8zZxazR/2JD9++TD2hOiwW/86TFCmCCeHctxGDgLedL1YIpzctCMnx9LNrRKpQ/Jj83X7ebUE6kC9eumk5RJBtwapTMKiX40sjs5RAqrCQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788253491; c=relaxed/simple; bh=K5adOlBiMa0yYmMZJxP73c0SVwU2yadNCgQ5ECt6Exg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PaDYxfanMG7X211pJi8yLAStYIltz4YA/omsKohVBqL3s76nr1C2qK6YnL4dWu2nXceaR2ra0P44Mr1ImEbrISyZKNbIFjG34Y4QMx0Q0YlmT/8cfCWVqKZud9N8PL+aC0/xvQMvqOkJfd1Nz0dFA73RWzz366jUSaP2NV7Tj+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=AmHSDqKi; arc=none smtp.client-ip=91.218.175.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="AmHSDqKi" X-Envelope-To: linux-kselftest@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=K5adOlBiMa0yYmMZJxP73c0SVwU2yadNCgQ5ECt6Exg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788253486; v=1; x=1788858286; b=AmHSDqKiyQnNoP3nOzui06pUEckABybku0hhy8gwPSMry/zytXPkZwIcMQaV17zjQW4zCA53 GwmSMcAx9Lai/6UAE6U6H3b9TWnrBfp8cD+lBJ0RDrWX5ZNyWzDbAOIY4pr+DiV4suTKEJ+3tSa P8iRQxdhcKkihrHBpGmV5iek= X-Envelope-To: linux-kselftest@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 5353e1dd7fab9237; Tue, 01 Sep 2026 09:04:46 +0000 X-Mizu-Trace-ID: 5353e1dd7fab9237 X-Migadu-Flow: FLOW_OUT Date: Tue, 1 Sep 2026 17:04:38 +0800 From: Hangbin Liu To: Chaithanya Lagisetty Cc: David Heidelberg , Bongsu Jeon , Shuah Khan , Jakub Kicinski , oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests: nci: Fix uninitialized family ID on missing attribute Message-ID: References: <20260901070618.3299012-1-nagachaithanya9911@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260901070618.3299012-1-nagachaithanya9911@gmail.com> On Tue, Sep 01, 2026 at 07:06:18AM +0000, Chaithanya Lagisetty wrote: > get_family_id() walks the generic netlink CTRL_CMD_GETFAMILY reply > looking for the CTRL_ATTR_FAMILY_ID attribute and returns the parsed > value in the local variable "id". If the reply does not carry that > attribute, the parsing loop never assigns "id" and the function returns > an indeterminate stack value, which the caller stores in self->fid and > uses for subsequent netlink requests. > > Initialize "id" to 0 so a missing attribute yields a deterministic > (invalid) family ID instead of a garbage value. > > Fixes: f595cf1242f3 ("selftests: Add nci suite") > Signed-off-by: Chaithanya Lagisetty > --- > tools/testing/selftests/nci/nci_dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c > index 312f84ee0444..ed306ec23895 100644 > --- a/tools/testing/selftests/nci/nci_dev.c > +++ b/tools/testing/selftests/nci/nci_dev.c > @@ -182,7 +182,7 @@ static int get_family_id(int sd, __u32 pid, __u32 *event_group) > } ans; > struct nlattr *na; > int resp_len; > - __u16 id; > + __u16 id = 0; > int len; > int rc; > > -- > 2.43.0 > Reviewed-by: Hangbin Liu