From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F7582D193F for ; Sun, 29 Mar 2026 07:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774771055; cv=none; b=dvuO8gzOhqSZ4aZILDyjSCir5Zmzptd2qfi8UJkLpA9CT7IT3Fs6DUrbJmMr5eSRvPN7eKuVFumNGllRx9MvF1DJ/nTEKyek4/kNe1Tt39DcNI5mTB83ZB2FhfSx8vL9Uz/tNjLBxxAISYFZVe4EVj7SPA8b+0DM3PjDSLHzqU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774771055; c=relaxed/simple; bh=oadnMheaGm/klZSdHj2zUg1sgeputMwsI7kKIj5VxlM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SZX4jwk2RW47v9oSTKNcZcmozwdvxoDT8RRoK8phIFZQ7rwgozZSBkyguGPJN9r8QxSHtDjKtN+ij8oGAXGKA3A9vlGAJRGEUNHE/BYO9v/KfbKGhbRY7XDOwk9m1gZ3QGZasF1TcrvYANVtn8imBwFlekQbbS9drK5ym0sxSdA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AvqeX6zl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AvqeX6zl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66291C116C6; Sun, 29 Mar 2026 07:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774771054; bh=oadnMheaGm/klZSdHj2zUg1sgeputMwsI7kKIj5VxlM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AvqeX6zlso+pibthwyUagIaQRBDNDUQaqBZPP9DoRQBdJdTsjBn7w4oGDHOrNopOv p6IMYZZO2vsC4VvjLbohQFb6EueCxO9oHwqTZpPdWKEWZ935y6I93Tzru0fjaskxJR 09JiplRCOsJ7R0GxiKUEVEbkBl564yWGlybn268s= Date: Sun, 29 Mar 2026 09:57:31 +0200 From: Greg KH To: Pengpeng Hou Cc: arnd@arndb.de, James.Bottomley@hansenpartnership.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] enclosure: bound sysfs link name construction Message-ID: <2026032959-splice-gush-8fdc@gregkh> References: <20260329030943.28672-1-pengpeng@iscas.ac.cn> <20260329073928.22257-1-pengpeng@iscas.ac.cn> 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: <20260329073928.22257-1-pengpeng@iscas.ac.cn> On Sun, Mar 29, 2026 at 03:39:28PM +0800, Pengpeng Hou wrote: > enclosure_link_name() prefixes the component device name with > "enclosure_device:" in a fixed 64-byte stack buffer. The helper > currently uses strcpy() and strcat() with no remaining-space check. > > enclosure_component_alloc() stores component names in a 64-byte buffer > and then uses dev_set_name() on that result, so dev_name(&cdev->cdev) > can already reach 63 characters. Prefixing that with the 17-byte > "enclosure_device:" string overflows the 64-byte link-name buffer. > > Use snprintf() so link-name construction stays within > ENCLOSURE_NAME_SIZE without changing the existing callers. > > Fixes: cb6b7f40630f ("[SCSI] ses: fix up functionality after class_device->device conversion") > Signed-off-by: Pengpeng Hou > --- > v2: > - wrap the changelog at 72 columns > - keep the fix to bounded link-name construction only That is not what I suggested that you do at all, sorry. Please go and re-read my last review. thanks, greg k-h