mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] iio: test: iio-test-format: char format test and overrun checks
@ 2026-11-02  8:33 Raffaele Tranfaglia via B4 Relay
  2026-11-02  8:33 ` [PATCH v2 1/2] iio: test: iio-test-format: check that nothing is written past the string Raffaele Tranfaglia via B4 Relay
  2026-11-02  8:33 ` [PATCH v2 2/2] iio: test: iio-test-format: add test case for char format Raffaele Tranfaglia via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Raffaele Tranfaglia via B4 Relay @ 2026-11-02  8:33 UTC (permalink / raw)
  To: Rodrigo Alencar, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko
  Cc: linux-iio, linux-kernel, Raffaele Tranfaglia, Andy Shevchenko

Add a KUnit test for IIO_VAL_CHAR formatting and, as suggested by
Andy, make IIO_TEST_FORMAT_EXPECT_EQ() check that iio_format_value()
does not write past the formatted string.

A NUL character is currently emitted as is, so the attribute reads
back as "\0\n". The test documents this behaviour; please let me
know if it should rather be rejected or handled differently.

These patches were written with the help of an LLM-based coding
assistant, which I used to draft the code and commit messages. I
reviewed and tested all changes myself.

Tested with KUnit on arm64 QEMU.

Signed-off-by: Raffaele Tranfaglia <raffaele.tranfaglia@gmail.com>
---
Changes in v2:
- Drop the Assisted-by tag and describe the tool use here (Andy)
- New patch 1: poison the buffer and check that nothing is written
  past the string (Andy)
- Add special, non-printable, NUL and out-of-range cases (Andy)
- Link to v1: https://patch.msgid.link/20261025-iio-test-format-char-v1-1-e2c208f90e87@gmail.com

---
Raffaele Tranfaglia (2):
      iio: test: iio-test-format: check that nothing is written past the string
      iio: test: iio-test-format: add test case for char format

 drivers/iio/test/iio-test-format.c | 117 +++++++++++++++++++++++++++++++------
 1 file changed, 100 insertions(+), 17 deletions(-)
---
base-commit: d1425b382b9cc5bd19223fad8ba4a8af3dbe1305
change-id: 20261025-iio-test-format-char-8a17fbf9a201

Best regards,
--  
Raffaele Tranfaglia <raffaele.tranfaglia@gmail.com>



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

end of thread, other threads:[~2026-11-02  8:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02  8:33 [PATCH v2 0/2] iio: test: iio-test-format: char format test and overrun checks Raffaele Tranfaglia via B4 Relay
2026-11-02  8:33 ` [PATCH v2 1/2] iio: test: iio-test-format: check that nothing is written past the string Raffaele Tranfaglia via B4 Relay
2026-11-02  8:33 ` [PATCH v2 2/2] iio: test: iio-test-format: add test case for char format Raffaele Tranfaglia via B4 Relay

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

all inboxes | Powered by JetHome®