* [PATCH] udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags
@ 2020-01-12 22:13 Pali Rohár
2020-01-13 11:39 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Pali Rohár @ 2020-01-12 22:13 UTC (permalink / raw)
To: linux-fsdevel, Jan Kara
Currently ENTITYID_FLAGS_* macros definitions are written as hex numbers
but their meaning is not bitwise-or flags. But rather bit position. This is
unusual and could be misleading. So change meaning of ENTITYID_FLAGS_*
macros definitions to be really bitwise-or flags.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
fs/udf/ecma_167.h | 4 ++--
fs/udf/super.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
index f9ee412fe..3fd85464a 100644
--- a/fs/udf/ecma_167.h
+++ b/fs/udf/ecma_167.h
@@ -95,8 +95,8 @@ struct regid {
} __packed;
/* Flags (ECMA 167r3 1/7.4.1) */
-#define ENTITYID_FLAGS_DIRTY 0x00
-#define ENTITYID_FLAGS_PROTECTED 0x01
+#define ENTITYID_FLAGS_DIRTY 0x01
+#define ENTITYID_FLAGS_PROTECTED 0x02
/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN 5
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 0dad63f88..7e6ec9fa0 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -773,7 +773,7 @@ static int udf_verify_domain_identifier(struct super_block *sb,
udf_warn(sb, "Not OSTA UDF compliant %s descriptor.\n", dname);
goto force_ro;
}
- if (ident->flags & (1 << ENTITYID_FLAGS_DIRTY)) {
+ if (ident->flags & ENTITYID_FLAGS_DIRTY) {
udf_warn(sb, "Possibly not OSTA UDF compliant %s descriptor.\n",
dname);
goto force_ro;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags
2020-01-12 22:13 [PATCH] udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags Pali Rohár
@ 2020-01-13 11:39 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2020-01-13 11:39 UTC (permalink / raw)
To: Pali Rohár; +Cc: linux-fsdevel, Jan Kara
On Sun 12-01-20 23:13:53, Pali Rohár wrote:
> Currently ENTITYID_FLAGS_* macros definitions are written as hex numbers
> but their meaning is not bitwise-or flags. But rather bit position. This is
> unusual and could be misleading. So change meaning of ENTITYID_FLAGS_*
> macros definitions to be really bitwise-or flags.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Thanks. I agree. I've added this patch to my tree.
Honza
> ---
> fs/udf/ecma_167.h | 4 ++--
> fs/udf/super.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
> index f9ee412fe..3fd85464a 100644
> --- a/fs/udf/ecma_167.h
> +++ b/fs/udf/ecma_167.h
> @@ -95,8 +95,8 @@ struct regid {
> } __packed;
>
> /* Flags (ECMA 167r3 1/7.4.1) */
> -#define ENTITYID_FLAGS_DIRTY 0x00
> -#define ENTITYID_FLAGS_PROTECTED 0x01
> +#define ENTITYID_FLAGS_DIRTY 0x01
> +#define ENTITYID_FLAGS_PROTECTED 0x02
>
> /* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
> #define VSD_STD_ID_LEN 5
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 0dad63f88..7e6ec9fa0 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -773,7 +773,7 @@ static int udf_verify_domain_identifier(struct super_block *sb,
> udf_warn(sb, "Not OSTA UDF compliant %s descriptor.\n", dname);
> goto force_ro;
> }
> - if (ident->flags & (1 << ENTITYID_FLAGS_DIRTY)) {
> + if (ident->flags & ENTITYID_FLAGS_DIRTY) {
> udf_warn(sb, "Possibly not OSTA UDF compliant %s descriptor.\n",
> dname);
> goto force_ro;
> --
> 2.20.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-13 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-12 22:13 [PATCH] udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags Pali Rohár
2020-01-13 11:39 ` Jan Kara
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).