From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (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 1DC1D22B8AB for ; Thu, 19 Feb 2026 08:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488936; cv=none; b=FtKQxFn4XjaCcGXfCuxD14ce02q2dd3kDImVRVOVBpzn48rehdpj/7CTPd+Y36ElnS7gG9QprrTeybRlpega6FU0GxBPRGdTA27tlEKMa9cnIWwDmkgcK4NbgDXBYkZBk5A3KhPC6r0X6e0U9+1I3CFZqROaU5kba7O2wuBVNV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488936; c=relaxed/simple; bh=Wdx3xmxNiGCvEPi4cuSBe9oyhc3dUiJSTOqJxC/Ply4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Moue7ewDFNzuJN2E8Go5WBS5TTKgppGlJ0WLv0dxnKjKAw6zMJHAurmejtCkoB2LguL/9KM11x4FbC3XVobxa98CTizQzJdQ5ebZY7NMzl6cifznbeqw04XPH/4T4LV0NQk7My7XrPuSt+FoTuqfjUGiuc570y+PKaBEoCL5DQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MfrG8cO3; arc=none smtp.client-ip=209.85.128.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MfrG8cO3" Received: by mail-wm1-f67.google.com with SMTP id 5b1f17b1804b1-4837907f535so5593615e9.3 for ; Thu, 19 Feb 2026 00:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771488933; x=1772093733; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jxz7fKRiqe7ydCP/cmXuqRgyR+949hjVQMB2zWdb5BQ=; b=MfrG8cO3foTAkBkmEZXGnCmX/ePljYP+p++h4aq4whMSHYNzbtK38Pz3ZMGKVZyfmz HoVCbhjKFL3uUPsHqMBrO8hBIIMH1kAJcaBtYfIRsZ0P7y5BGjBMixgCm1ajWvgblsKK TJLuQautj2TzTRFkq7wOGLN0bYauUBGejy67xEyceVoIVrpa7/78VP10v0/s3N4GnzjT /D9C8HZWv4xALpSIrOL2Nr23jVka0+1YCpZynu8OlRiaNwtRvTCxPw3zGKYYNpb2TU/O A1axolk6hBlW8wjaCvtpzgkqMK1OsAObYSWTDBXMseYGcnL43ObNbafTS+ywSA+Pga2P T3JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771488933; x=1772093733; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jxz7fKRiqe7ydCP/cmXuqRgyR+949hjVQMB2zWdb5BQ=; b=ff7Rcpfd4z8977ZnGLEC78sqhibzdWodxR3SH5eibDqgGvfZxbSD6Ca51Q07t/ak4X q9bgc7hpEXLxqf8WDN4wXowsD+vQ6qe96ygWFruS6nXT6gEVkmhz5LB85gtpq5QFphVR ShF3bRkEbh+GMRy07rW6CYfnHN6Tplk7xpiNXOOUbpWDQIPz8CkApTBVX8L52cOQrZfG fK2fuLjAZkZWFxjeMu42fU/l1ygXH6B2bNCsdDt1gwWRHqXTJNa4jLfLHua4NHBiqEHr wVo+NgFyNtQvNIJSJLEHAH6Jxs7R+SyO77T0WhfAT4Lb2zH4nt/ZAR9B+t3vaUXz68KD +JjQ== X-Forwarded-Encrypted: i=1; AJvYcCVVNzygrc3uqcoaoShPKa35f4HJ7fef34tVF1NPPGeZcFdHdqZsbqM7gSgTs5DtZFKBSyOVHP587sJq0K4=@vger.kernel.org X-Gm-Message-State: AOJu0YxDbwRCg3YFLPs720mvnj2DuVUR6r6k2p/4YW//L1SAejEsfOyR 4kDymbkLRNslO/CpYOW+/heZbAN8flHwE6mEGC+6keTNpXKziKFSc/oZJziGgRtuCqU= X-Gm-Gg: AZuq6aJGBBetMw8vr7SAE9YgS4G7TMjSCSpZe4cXd+ORvF2JexpBMzvUm4J9rIczwED n0XWkpMPIChBCm4FgyXk1aLKuevU/JguJ7iQVBEqXUM+rcTl1bc5O49aWbyKqzsQdK891HCAzX3 RU4cO2YJHndlB38ODTbASb+o+84z8QEWWoOh+KzQ2Q8cfwFEkOgRgoV94MxjWTO+mDPfnob1wll 32nzTjABMSkvr1tZ5tmg5uIF7ufjjE33NBKEnE3SqgnoJatcapmdemo6v1lnmAUwenGnt7+VrKp 7rzfio50z/M8Zy5WmBSLxWNumwhrD86G53FXrQAsec+GF/GCFv8wfqJ8xAI1VrzgYWMVF+0mRMn 8jRqGHzkD8VeuRC05IJdJxqgEF+Iymgq8cR2yBD2Vd4sZznScdEVzSsYD4rKyaNBQR9cMP1Kpfr 7/HSDB/3IVNOPiODcxRnSqQFhWvWL1 X-Received: by 2002:a05:600c:608c:b0:483:103c:b1ee with SMTP id 5b1f17b1804b1-48379b8c009mr265672865e9.8.1771488933255; Thu, 19 Feb 2026 00:15:33 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4839e7f30b0sm27232955e9.0.2026.02.19.00.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 00:15:32 -0800 (PST) Date: Thu, 19 Feb 2026 11:15:29 +0300 From: Dan Carpenter To: Mariyam Shahid Cc: Greg Kroah-Hartman , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8723bs: use kzalloc_obj() instead of kzalloc() Message-ID: References: <20260216161733.7704-1-mariyam.shahid135@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20260216161733.7704-1-mariyam.shahid135@gmail.com> On Mon, Feb 16, 2026 at 09:17:33PM +0500, Mariyam Shahid wrote: > Replace kzalloc() using sizeof(*ptr) with kzalloc_obj() to improve > type safety. kzalloc_obj() ensures that the size allocated matches > the type of the pointer automatically, which prevents potential > mismatches if the pointer type is ever refactored. > > This change cleans up a checkpatch.pl warning: > "Prefer kzalloc_obj over kzalloc with sizeof" > > Signed-off-by: Mariyam Shahid > --- > drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c > index 22dc36e8e38a..8cb9a760f763 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c > @@ -1954,7 +1954,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp > } > > if (enqueue) { > - pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); > + pcmd = kzalloc_obj(pcmd, GFP_KERNEL); This introduces a bug. It should be kzalloc_obj(*pcmd with an asterisk. Also there are several other conversions which are possible in this file... regards, dan carpenter