From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 C88EF86323 for ; Thu, 16 Jan 2025 08:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737015331; cv=none; b=rErcf3imwm1d92lfOxfOq963sezH+WysP+tYTTw7kn5WLNRDr/YNlwcAnC3asKR2CW1DjCt5yferUqAJq/BkzBu3XU+h0M/CvXs70yVJvcOxU/TEWAxdUX4aUqagNzEuv2LoL0NVJ6hQ0OQdkaQlJ4SJuMqYXqpOnc/ASuVqEPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737015331; c=relaxed/simple; bh=Fxv84fakHAb+05heeGa1dFMYPCKGW4XkQZjsKZbSBQw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hweG0H2C09pcfehwQJe5qIE+M4zJWFUAK9icna9qG0bNi0mjA/3ReltPIpgvP5zsPgCS3Z08azZ3Q7hF6rgOV0mFq3Wn4hVlN2fo4OQvLE4TX90utUC2wDgbnrNX46AOXHEVPSzeklxEWoqYHo/9mBxk9C3YQ6lV9QBiK/q+GRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hUXEzuUF; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hUXEzuUF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737015328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=weTwTYIz2yhpXnmwTK+tEHXkmKb/g8sy0E66UfcVH7I=; b=hUXEzuUFmyin/WcvOn6J7g08BXTKvtRiNOyCtSnbt6XQABVi+V0YR91o3pr6l4yZ/XXc2H mjBRMOMghRuSEoqIlJ2oCLKPkjxWsue9+EIpfSTnWa4ds7bGWbu+vMHFFlSC3Wgk2g1JEn mZnFrlBa/ju/3ehAc7FI13dP3MC13SY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-OFa6DVawNs-CjLEci6txLg-1; Thu, 16 Jan 2025 03:15:27 -0500 X-MC-Unique: OFa6DVawNs-CjLEci6txLg-1 X-Mimecast-MFC-AGG-ID: OFa6DVawNs-CjLEci6txLg Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-385e03f54d0so281165f8f.3 for ; Thu, 16 Jan 2025 00:15:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737015325; x=1737620125; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=weTwTYIz2yhpXnmwTK+tEHXkmKb/g8sy0E66UfcVH7I=; b=OMCVLXwMiqXZQKoUBEIZXeBYD8ZsUyM4+J0XfotFD/BJls/GnVOkzntB2TtzWZYfkg bLQXNl+99d7cqLFPLJGALzprLxaA7HDlX/QYaJ1quLQcknHK5tHiZxCfZQTBEUpL/H7s VrBzkym8OawJhkZs6h8IcPqh/b4Hbl8UsKw2UL8/wINH9yZVP/oqVw6vkdKKtX0Ctihq /PjIQ7vTkO+m1ResSMebc2KR48S8gtQlQnntLxabjN4imsqlOxz/V4wTQ0BeaP0nqQzg G/KC8O1/chipdSmL9QYkBy9G0AlbyXmiGX6No05y30ON+9c18UZ4tnpFsPf+9tXQrfs9 i5Mg== X-Forwarded-Encrypted: i=1; AJvYcCXm+Emk69acolNCJFxq8mSmkUbTtrsE2U5oCo46dGfhX6SMGmX/sK9vVfSBqXjFl4qO+OC3PXME4mIps7M=@vger.kernel.org X-Gm-Message-State: AOJu0YyQBOGrAkd+jIvrWa7pku83RSx8UX7w9+Bmf4OAN7DI2r1aPBAH ITCWMqYHpTL4HWuK9I9TLhFw1doHtz3ONP51n17i8AThGOJyLz1lkhZuF6B0WpyevlOLZFxVHL/ 3b7/vWjXvrTBUQi2lWxGoB73WNnb5rnsWS34UbS4+w21OQTeI7lD86XfSnRQm68IbVPS2VA== X-Gm-Gg: ASbGncvCk6kt9YqzZlxM1eHlc31QFz3ZV4RyKmm+v9EBG6EtS4ld94BJ8m7ooF8EItT dZrSQMwEcyNH6EcWmNBkW0pWDm3JUKh7sQ219mbbHE7/AvvLUlBK0BMJw96uYbdFZuf26X7ZsI2 BfwPTsaruNhZ0G1zotq/lVrmN55/7YzNjPqcjOGaEMEhuPxUgUuRhnJqa4jqwYpGZDFgqmexHHG tMmBhIiFjCI0t3UgmazSxmezCLPudKAWRfHE1+mpg/9yGqbnrEb X-Received: by 2002:a05:6000:719:b0:385:e879:45cc with SMTP id ffacd0b85a97d-38a873045d9mr24381364f8f.19.1737015325581; Thu, 16 Jan 2025 00:15:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGimk/Aihf6evbwdWU/Nhj5k4t/+X/4NMOaE3XhbUkvoOP29Y2uSPLQT9Pi8OYtRe/om41oyg== X-Received: by 2002:a05:6000:719:b0:385:e879:45cc with SMTP id ffacd0b85a97d-38a873045d9mr24381343f8f.19.1737015325241; Thu, 16 Jan 2025 00:15:25 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c5bb5sm51715175e9.22.2025.01.16.00.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 00:15:24 -0800 (PST) Date: Thu, 16 Jan 2025 03:15:20 -0500 From: "Michael S. Tsirkin" To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Gabriel Somlo , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] firmware: qemu_fw_cfg: constify 'struct bin_attribute' Message-ID: <20250116031512-mutt-send-email-mst@kernel.org> References: <20250114-sysfs-const-bin_attr-qemu_fw_cfg-v1-1-76f525a3ee72@weissschuh.net> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250114-sysfs-const-bin_attr-qemu_fw_cfg-v1-1-76f525a3ee72@weissschuh.net> On Tue, Jan 14, 2025 at 10:50:20PM +0100, Thomas Weißschuh wrote: > The sysfs core now allows instances of 'struct bin_attribute' to be > moved into read-only memory. Make use of that to protect them against > accidental or malicious modifications. > > Signed-off-by: Thomas Weißschuh why not Acked-by: Michael S. Tsirkin > --- > drivers/firmware/qemu_fw_cfg.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c > index d58da3e4500a5e230b7da9a75e4d70df7c38c542..2615fb780e3c4500db36d4746880455f05479f1f 100644 > --- a/drivers/firmware/qemu_fw_cfg.c > +++ b/drivers/firmware/qemu_fw_cfg.c > @@ -460,7 +460,7 @@ static const struct kobj_type fw_cfg_sysfs_entry_ktype = { > > /* raw-read method and attribute */ > static ssize_t fw_cfg_sysfs_read_raw(struct file *filp, struct kobject *kobj, > - struct bin_attribute *bin_attr, > + const struct bin_attribute *bin_attr, > char *buf, loff_t pos, size_t count) > { > struct fw_cfg_sysfs_entry *entry = to_entry(kobj); > @@ -474,9 +474,9 @@ static ssize_t fw_cfg_sysfs_read_raw(struct file *filp, struct kobject *kobj, > return fw_cfg_read_blob(entry->select, buf, pos, count); > } > > -static struct bin_attribute fw_cfg_sysfs_attr_raw = { > +static const struct bin_attribute fw_cfg_sysfs_attr_raw = { > .attr = { .name = "raw", .mode = S_IRUSR }, > - .read = fw_cfg_sysfs_read_raw, > + .read_new = fw_cfg_sysfs_read_raw, > }; > > /* > > --- > base-commit: 7f5b6a8ec18e3add4c74682f60b90c31bdf849f2 > change-id: 20250114-sysfs-const-bin_attr-qemu_fw_cfg-fa4a95934904 > > Best regards, > -- > Thomas Weißschuh >