As this is during init this allocation should not fail and given that the code is in this state now for 4 years+ this seems to have worked. kmalloc should be checked though or forced not to fail - Not really sure but this case seems suitable for __GFP_NOFAIL (relatively small allocation early in the boot process where it should not fail). The alternative would probably be a BUG_ON(!new_compat); here.
Issue was introduced by commit f2dd36ac9974 ("OMAPDSS: move 'compatible' converter to omapdss driver")
and there is the identical issue in: ./drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c:113:
Pleas let me know if that fix (use of __GFP_NOFAIL) is suitable for this situation.
Signed-off-by: Nicholas Mc Guire hofrat@osadl.org Fixes: f2dd36ac9974 ("OMAPDSS: move 'compatible' converter to omapdss driver") ---
Issue located with an experimental coccinelle script
Patch was compile tested with: omap2plus_defconfig (implies OMAP2_DSS_INIT=y)
Patch is against 4.18 (localversion-next is next-20180824)
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c index 3bfb95d..1e07c07 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c @@ -110,7 +110,7 @@ static void __init omapdss_omapify_node(struct device_node *node) num_strs = omapdss_count_strings(prop);
new_len = prop->length + strlen(prefix) * num_strs; - new_compat = kmalloc(new_len, GFP_KERNEL); + new_compat = kmalloc(new_len, GFP_KERNEL | __GFP_NOFAIL);
omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
dri-devel@lists.freedesktop.org