public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH 0/3] This series addresses several minor issues found using sparse.
@ 2025-04-04  1:28 Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 1/3] bcachefs: Fix escape sequence in prt_printf Gabriel Shahrouzi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gabriel Shahrouzi @ 2025-04-04  1:28 UTC (permalink / raw)
  To: kent.overstreet
  Cc: gshahrouzi, linux-bcachefs, shuah, linux-kernel,
	linux-kernel-mentees

The first patch fixes a typo ('\%u') in a format specifier within a print
statement. The incorrect sequence was replaced as it didn't appear
to be the author's intent.

The second patch corrects the type for a function argument to __le64,
which fixes two related sparse warnings. Although the argument data
is already little-endian, using the specific __le64 type improves
consistency and makes the expected data format explicit.

The third patch ensures cpu_to_le16() is used when preparing certain
on-disk data (directory entry lengths). This maintains correct byte
ordering for big-endian systems.

Gabriel Shahrouzi (3):
  bcachefs: Fix escape sequence in prt_printf
  bcachefs: Fix type for parameter in
    journal_advance_devs_to_next_bucket
  bcachefs: Use cpu_to_le16 for dirent lengths

 fs/bcachefs/data_update.c | 2 +-
 fs/bcachefs/dirent.c      | 4 ++--
 fs/bcachefs/journal_io.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] bcachefs: Fix escape sequence in prt_printf
  2025-04-04  1:28 [PATCH 0/3] This series addresses several minor issues found using sparse Gabriel Shahrouzi
@ 2025-04-04  1:28 ` Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 2/3] bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket Gabriel Shahrouzi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gabriel Shahrouzi @ 2025-04-04  1:28 UTC (permalink / raw)
  To: kent.overstreet
  Cc: gshahrouzi, linux-bcachefs, shuah, linux-kernel,
	linux-kernel-mentees

Remove backslash before format specifier. Ensure correct output.

Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
---
 fs/bcachefs/data_update.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c
index fe400dfc5d76..9fb020a58d86 100644
--- a/fs/bcachefs/data_update.c
+++ b/fs/bcachefs/data_update.c
@@ -607,7 +607,7 @@ void bch2_data_update_inflight_to_text(struct printbuf *out, struct data_update
 	prt_newline(out);
 	printbuf_indent_add(out, 2);
 	bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts);
-	prt_printf(out, "read_done:\t\%u\n", m->read_done);
+	prt_printf(out, "read_done:\t%u\n", m->read_done);
 	bch2_write_op_to_text(out, &m->op);
 	printbuf_indent_sub(out, 2);
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket
  2025-04-04  1:28 [PATCH 0/3] This series addresses several minor issues found using sparse Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 1/3] bcachefs: Fix escape sequence in prt_printf Gabriel Shahrouzi
@ 2025-04-04  1:28 ` Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 3/3] bcachefs: Use cpu_to_le16 for dirent lengths Gabriel Shahrouzi
  2025-04-04  1:34 ` [PATCH 0/3] This series addresses several minor issues found using sparse Kent Overstreet
  3 siblings, 0 replies; 5+ messages in thread
From: Gabriel Shahrouzi @ 2025-04-04  1:28 UTC (permalink / raw)
  To: kent.overstreet
  Cc: gshahrouzi, linux-bcachefs, shuah, linux-kernel,
	linux-kernel-mentees

Replace u64 with __le64 to match the expected parameter type. Ensure consistency both in function calls and within the function itself.

Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
---
 fs/bcachefs/journal_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 2debc213e47c..ff2fd20aa8b0 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1460,7 +1460,7 @@ int bch2_journal_read(struct bch_fs *c,
 
 static void journal_advance_devs_to_next_bucket(struct journal *j,
 						struct dev_alloc_list *devs,
-						unsigned sectors, u64 seq)
+						unsigned sectors, __le64 seq)
 {
 	struct bch_fs *c = container_of(j, struct bch_fs, journal);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] bcachefs: Use cpu_to_le16 for dirent lengths
  2025-04-04  1:28 [PATCH 0/3] This series addresses several minor issues found using sparse Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 1/3] bcachefs: Fix escape sequence in prt_printf Gabriel Shahrouzi
  2025-04-04  1:28 ` [PATCH 2/3] bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket Gabriel Shahrouzi
@ 2025-04-04  1:28 ` Gabriel Shahrouzi
  2025-04-04  1:34 ` [PATCH 0/3] This series addresses several minor issues found using sparse Kent Overstreet
  3 siblings, 0 replies; 5+ messages in thread
From: Gabriel Shahrouzi @ 2025-04-04  1:28 UTC (permalink / raw)
  To: kent.overstreet
  Cc: gshahrouzi, linux-bcachefs, shuah, linux-kernel,
	linux-kernel-mentees

Prevent incorrect byte ordering for big-endian systems.

Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
---
 fs/bcachefs/dirent.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c
index d7f9f79318a2..82ea6c437143 100644
--- a/fs/bcachefs/dirent.c
+++ b/fs/bcachefs/dirent.c
@@ -287,8 +287,8 @@ static void dirent_init_casefolded_name(struct bkey_i_dirent *dirent,
 	EBUG_ON(!dirent->v.d_casefold);
 	EBUG_ON(!cf_name->len);
 
-	dirent->v.d_cf_name_block.d_name_len = name->len;
-	dirent->v.d_cf_name_block.d_cf_name_len = cf_name->len;
+	dirent->v.d_cf_name_block.d_name_len = cpu_to_le16(name->len);
+	dirent->v.d_cf_name_block.d_cf_name_len = cpu_to_le16(cf_name->len);
 	memcpy(&dirent->v.d_cf_name_block.d_names[0], name->name, name->len);
 	memcpy(&dirent->v.d_cf_name_block.d_names[name->len], cf_name->name, cf_name->len);
 	memset(&dirent->v.d_cf_name_block.d_names[name->len + cf_name->len], 0,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] This series addresses several minor issues found using sparse.
  2025-04-04  1:28 [PATCH 0/3] This series addresses several minor issues found using sparse Gabriel Shahrouzi
                   ` (2 preceding siblings ...)
  2025-04-04  1:28 ` [PATCH 3/3] bcachefs: Use cpu_to_le16 for dirent lengths Gabriel Shahrouzi
@ 2025-04-04  1:34 ` Kent Overstreet
  3 siblings, 0 replies; 5+ messages in thread
From: Kent Overstreet @ 2025-04-04  1:34 UTC (permalink / raw)
  To: Gabriel Shahrouzi
  Cc: linux-bcachefs, shuah, linux-kernel, linux-kernel-mentees

On Thu, Apr 03, 2025 at 09:28:19PM -0400, Gabriel Shahrouzi wrote:
> The first patch fixes a typo ('\%u') in a format specifier within a print
> statement. The incorrect sequence was replaced as it didn't appear
> to be the author's intent.
> 
> The second patch corrects the type for a function argument to __le64,
> which fixes two related sparse warnings. Although the argument data
> is already little-endian, using the specific __le64 type improves
> consistency and makes the expected data format explicit.
> 
> The third patch ensures cpu_to_le16() is used when preparing certain
> on-disk data (directory entry lengths). This maintains correct byte
> ordering for big-endian systems.

Thanks, series is applied.

> 
> Gabriel Shahrouzi (3):
>   bcachefs: Fix escape sequence in prt_printf
>   bcachefs: Fix type for parameter in
>     journal_advance_devs_to_next_bucket
>   bcachefs: Use cpu_to_le16 for dirent lengths
> 
>  fs/bcachefs/data_update.c | 2 +-
>  fs/bcachefs/dirent.c      | 4 ++--
>  fs/bcachefs/journal_io.c  | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-04  1:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04  1:28 [PATCH 0/3] This series addresses several minor issues found using sparse Gabriel Shahrouzi
2025-04-04  1:28 ` [PATCH 1/3] bcachefs: Fix escape sequence in prt_printf Gabriel Shahrouzi
2025-04-04  1:28 ` [PATCH 2/3] bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket Gabriel Shahrouzi
2025-04-04  1:28 ` [PATCH 3/3] bcachefs: Use cpu_to_le16 for dirent lengths Gabriel Shahrouzi
2025-04-04  1:34 ` [PATCH 0/3] This series addresses several minor issues found using sparse Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox