devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes for bbb-overlays
@ 2015-11-17 12:43 Geert Uytterhoeven
       [not found] ` <1447764240-10709-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-11-17 12:43 UTC (permalink / raw)
  To: Pantelis Antoniou; +Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

	Hi Pantelis,

Now HCH's configfs cleanups have entered v4.4-rc1, I had to upgrade to a
newer version of your overlay series.

The following 2 patches:
  - Kill a compiler warning on 64-bit (yes, using overlays on arm64 ;-),
  - Fix an ugly "allocation failure" backtrace when reading empty binary
    attributes.

I sent earlier versions of these before, but they had to be rebased to
adapt to changes in your bbb-overlays branch.

Geert Uytterhoeven (2):
  of/configfs: Use %zu to format size_t
  configfs: Fix reading empty binary attributes

 drivers/of/configfs.c | 2 +-
 fs/configfs/file.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/2] of/configfs: Use %zu to format size_t
       [not found] ` <1447764240-10709-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
@ 2015-11-17 12:43   ` Geert Uytterhoeven
  2015-11-17 12:44   ` [PATCH 2/2] configfs: Fix reading empty binary attributes Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-11-17 12:43 UTC (permalink / raw)
  To: Pantelis Antoniou; +Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

On 64-bit:

    drivers/of/configfs.c: In function 'cfs_overlay_item_dtbo_read':
    drivers/of/configfs.c:153:2: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' [-Wformat=]
      pr_debug("%s: buf=%p max_count=%u\n", __func__,
      ^

Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Fixes: 353733fae1932992 ("OF: DT-Overlay configfs interface (v6)")
---
Against
https://github.com/pantoniou/linux-beagle-track-mainline.git/bbb-overlays
---
 drivers/of/configfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
index b68dea8f4ce1e508..563663eefe17c9f1 100644
--- a/drivers/of/configfs.c
+++ b/drivers/of/configfs.c
@@ -150,7 +150,7 @@ ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, void *buf,
 {
 	struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
 
-	pr_debug("%s: buf=%p max_count=%u\n", __func__,
+	pr_debug("%s: buf=%p max_count=%zu\n", __func__,
 			buf, max_count);
 
 	if (overlay->dtbo == NULL)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] configfs: Fix reading empty binary attributes
       [not found] ` <1447764240-10709-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
  2015-11-17 12:43   ` [PATCH 1/2] of/configfs: Use %zu to format size_t Geert Uytterhoeven
@ 2015-11-17 12:44   ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2015-11-17 12:44 UTC (permalink / raw)
  To: Pantelis Antoniou; +Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

When trying to read an empty binary attribute in configfs, an OOM
message is printed:

    vmalloc: allocation failure: 0 bytes
    cat: page allocation failure: order:0, mode:0x24000c2
    CPU: 1 PID: 1731 Comm: cat Tainted: G        W       4.4.0-rc1-koelsch-01576-g480a69c050d4f3ee-dirty #1977
    Hardware name: Generic R8A7791 (Flattened Device Tree)
    [<c00173a0>] (unwind_backtrace) from [<c0013094>] (show_stack+0x10/0x14)
    [<c0013094>] (show_stack) from [<c01f1f38>] (dump_stack+0x70/0x8c)
    [<c01f1f38>] (dump_stack) from [<c00b6930>] (warn_alloc_failed+0xe4/0x110)
    [<c00b6930>] (warn_alloc_failed) from [<c00dde1c>] (__vmalloc_node_range+0x1cc/0x1f0)
    [<c00dde1c>] (__vmalloc_node_range) from [<c00dde88>] (__vmalloc_node+0x48/0x58)
    [<c00dde88>] (__vmalloc_node) from [<c00ddec4>] (vmalloc+0x2c/0x3c)
    [<c00ddec4>] (vmalloc) from [<c0148304>] (configfs_read_bin_file+0x98/0x118)
    [<c0148304>] (configfs_read_bin_file) from [<c00e8a88>] (__vfs_read+0x20/0xcc)
    [<c00e8a88>] (__vfs_read) from [<c00e918c>] (vfs_read+0x84/0xec)
    [<c00e918c>] (vfs_read) from [<c00e9914>] (SyS_read+0x40/0x80)

Unlike kmalloc(), vmalloc() doesn't support allocating zero bytes.
Hence return early if ops->read_bin_attribute() returns zero.

Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Fixes: 016dd7ff3c56526f ("configfs: Implement binary attributes (v5)")
---
Against
https://github.com/pantoniou/linux-beagle-track-mainline.git/bbb-overlays

How to reproduce:
  - mkdir /sys/kernel/config/device-tree/overlays/dummy
  - cat /sys/kernel/config/device-tree/overlays/dummy/dtbo
---
 fs/configfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index a3a3c6695fbf1950..20d59bf4737379e3 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -172,7 +172,7 @@ configfs_read_bin_file(struct file *file, char __user *buf,
 
 		/* perform first read with buf == NULL to get extent */
 		len = bin_attr->read(item, NULL, 0);
-		if (len < 0) {
+		if (len <= 0) {
 			retval = len;
 			goto out;
 		}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-11-17 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 12:43 [PATCH 0/2] Fixes for bbb-overlays Geert Uytterhoeven
     [not found] ` <1447764240-10709-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2015-11-17 12:43   ` [PATCH 1/2] of/configfs: Use %zu to format size_t Geert Uytterhoeven
2015-11-17 12:44   ` [PATCH 2/2] configfs: Fix reading empty binary attributes Geert Uytterhoeven

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).