From: Nayna <nayna@linux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-efi@vger.kernel.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Eric Ricther <erichte@linux.ibm.com>,
Nayna Jain <nayna@linux.ibm.com>,
linux-kernel@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>,
Claudio Carvalho <cclaudio@linux.ibm.com>,
Matthew Garret <matthew.garret@nebula.com>,
linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
Jeremy Kerr <jk@ozlabs.org>, Elaine Palmer <erpalmer@us.ibm.com>,
"Oliver O'Halloran" <oohall@gmail.com>,
linux-integrity@vger.kernel.org,
George Wilson <gcwilson@linux.ibm.com>
Subject: Re: [PATCH] sysfs: add BIN_ATTR_WO() macro
Date: Tue, 1 Oct 2019 14:08:53 -0400 [thread overview]
Message-ID: <7546990b-8060-9451-129a-19aaa856d2e1@linux.vnet.ibm.com> (raw)
In-Reply-To: <20190826150153.GD18418@kroah.com>
Hi Greg,
On 08/26/2019 11:01 AM, Greg Kroah-Hartman wrote:
> This variant was missing from sysfs.h, I guess no one noticed it before.
>
> Turns out the powerpc secure variable code can use it, so add it to the
> tree for it, and potentially others to take advantage of, instead of
> open-coding it.
>
> Reported-by: Nayna Jain <nayna@linux.ibm.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> I'll queue this up to my tree for 5.4-rc1, but if you want to take this
> in your tree earlier, feel free to do so.
>
> include/linux/sysfs.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
> index 965236795750..5420817ed317 100644
> --- a/include/linux/sysfs.h
> +++ b/include/linux/sysfs.h
> @@ -196,6 +196,12 @@ struct bin_attribute {
> .size = _size, \
> }
>
> +#define __BIN_ATTR_WO(_name) { \
> + .attr = { .name = __stringify(_name), .mode = 0200 }, \
> + .store = _name##_store, \
> + .size = _size, \
> +}
> +
> #define __BIN_ATTR_RW(_name, _size) \
> __BIN_ATTR(_name, 0644, _name##_read, _name##_write, _size)
>
> @@ -208,6 +214,9 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
> #define BIN_ATTR_RO(_name, _size) \
> struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
>
> +#define BIN_ATTR_WO(_name, _size) \
> +struct bin_attribute bin_attr_##_name = __BIN_ATTR_WO(_name, _size)
> +
> #define BIN_ATTR_RW(_name, _size) \
> struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
>
I am sorry. I didn't notice it via inspection but there is a bug in this
macro. When I actually try using it, compilation fails. Here's a likely
patch:
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 5420817ed317..fa7ee503fb76 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -196,9 +196,9 @@ struct bin_attribute {
.size = _size, \
}
-#define __BIN_ATTR_WO(_name) { \
+#define __BIN_ATTR_WO(_name, _size) { \
.attr = { .name = __stringify(_name), .mode = 0200 }, \
- .store = _name##_store, \
+ .write = _name##_write, \
.size = _size, \
}
Thanks & Regards,
- Nayna
next prev parent reply other threads:[~2019-10-01 18:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 13:23 [PATCH v3 0/4] powerpc: expose secure variables to the kernel and userspace Nayna Jain
2019-08-26 13:23 ` [PATCH v3 1/4] powerpc/powernv: Add OPAL API interface to access secure variable Nayna Jain
2019-08-26 13:23 ` [PATCH v3 2/4] powerpc: expose secure variables to userspace via sysfs Nayna Jain
2019-08-26 14:01 ` Greg Kroah-Hartman
2019-08-26 14:12 ` Nayna
2019-08-26 15:01 ` [PATCH] sysfs: add BIN_ATTR_WO() macro Greg Kroah-Hartman
2019-09-03 3:37 ` Michael Ellerman
2019-09-04 11:36 ` Greg Kroah-Hartman
2019-10-01 18:08 ` Nayna [this message]
2019-10-01 18:16 ` Greg Kroah-Hartman
2019-10-01 18:55 ` Nayna
2019-08-26 14:56 ` [PATCH v3 2/4] powerpc: expose secure variables to userspace via sysfs Greg Kroah-Hartman
2019-08-26 15:46 ` Nayna
2019-08-26 15:57 ` Greg Kroah-Hartman
2019-08-26 13:23 ` [PATCH v3 3/4] x86/efi: move common keyring handler functions to new file Nayna Jain
2019-09-02 11:55 ` Michael Ellerman
2019-09-03 22:51 ` Mimi Zohar
2019-09-05 3:59 ` Michael Ellerman
2019-08-26 13:23 ` [PATCH v3 4/4] powerpc: load firmware trusted keys/hashes into kernel keyring Nayna Jain
2019-09-03 22:54 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7546990b-8060-9451-129a-19aaa856d2e1@linux.vnet.ibm.com \
--to=nayna@linux.vnet.ibm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=cclaudio@linux.ibm.com \
--cc=erichte@linux.ibm.com \
--cc=erpalmer@us.ibm.com \
--cc=gcwilson@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jk@ozlabs.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=matthew.garret@nebula.com \
--cc=nayna@linux.ibm.com \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).