* [PATCH] edac: xgene: Fix possible sprintf overflow issue
@ 2015-09-24 17:38 Loc Ho
[not found] ` <1443116287-11752-1-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Loc Ho @ 2015-09-24 17:38 UTC (permalink / raw)
To: dougthompson-aS9lmoZGLiVWk0Htik3J/w, bp-Gina5bIWoIWzQB+pC5nmwQ,
mchehab-JPH+aEBZ4P+UEJcrhfAQsw, arnd-r2nGTMty4D4
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
linux-edac-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
jcm-H+wXaHxf7aLQT0dZR+AlfA, patches-qTEPVZfXA3Y, Loc Ho
Replace sprintf with snprintf to avoid possible string array overflow.
Signed-off-by: Loc Ho <lho-qTEPVZfXA3Y@public.gmane.org>
---
drivers/edac/xgene_edac.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
index 37121e8..dfa13bb 100644
--- a/drivers/edac/xgene_edac.c
+++ b/drivers/edac/xgene_edac.c
@@ -879,7 +879,7 @@ xgene_edac_pmd_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev)
if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs)
return;
- sprintf(name, "PMD%d", ctx->pmd);
+ snprintf(name, sizeof(name), "PMD%d", ctx->pmd);
dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs);
if (!dbgfs_dir)
return;
@@ -923,7 +923,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np,
goto err_group;
}
- sprintf(edac_name, "l2c%d", pmd);
+ snprintf(edac_name, sizeof(edac_name), "l2c%d", pmd);
edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
edac_name, 1, "l2c", 1, 2, NULL,
0, edac_device_alloc_index());
@@ -1183,7 +1183,7 @@ xgene_edac_l3_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev)
if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs)
return;
- sprintf(name, "l3c%d", ctx->edac_idx);
+ snprintf(name, sizeof(name), "l3c%d", ctx->edac_idx);
dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs);
if (!dbgfs_dir)
return;
--
1.7.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] 4+ messages in thread[parent not found: <1443116287-11752-1-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>]
* Re: [PATCH] edac: xgene: Fix possible sprintf overflow issue [not found] ` <1443116287-11752-1-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org> @ 2015-09-25 13:45 ` Borislav Petkov [not found] ` <20150925134551.GE3568-fF5Pk5pvG8Y@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Borislav Petkov @ 2015-09-25 13:45 UTC (permalink / raw) To: Loc Ho Cc: dougthompson-aS9lmoZGLiVWk0Htik3J/w, mchehab-JPH+aEBZ4P+UEJcrhfAQsw, arnd-r2nGTMty4D4, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, linux-edac-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jcm-H+wXaHxf7aLQT0dZR+AlfA, patches-qTEPVZfXA3Y On Thu, Sep 24, 2015 at 10:38:07AM -0700, Loc Ho wrote: > Replace sprintf with snprintf to avoid possible string array overflow. > > Signed-off-by: Loc Ho <lho-qTEPVZfXA3Y@public.gmane.org> > --- > drivers/edac/xgene_edac.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c > index 37121e8..dfa13bb 100644 > --- a/drivers/edac/xgene_edac.c > +++ b/drivers/edac/xgene_edac.c > @@ -879,7 +879,7 @@ xgene_edac_pmd_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev) > if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs) > return; > > - sprintf(name, "PMD%d", ctx->pmd); > + snprintf(name, sizeof(name), "PMD%d", ctx->pmd); > dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs); > if (!dbgfs_dir) > return; > @@ -923,7 +923,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np, > goto err_group; > } > > - sprintf(edac_name, "l2c%d", pmd); > + snprintf(edac_name, sizeof(edac_name), "l2c%d", pmd); > edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx), > edac_name, 1, "l2c", 1, 2, NULL, > 0, edac_device_alloc_index()); > @@ -1183,7 +1183,7 @@ xgene_edac_l3_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev) > if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs) > return; > > - sprintf(name, "l3c%d", ctx->edac_idx); > + snprintf(name, sizeof(name), "l3c%d", ctx->edac_idx); > dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs); > if (!dbgfs_dir) > return; All 5 applied. I've merged the last hunk changing xgene_edac_l3_create_debugfs_nodes into the second patch which adds the L3 support. Thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- 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] 4+ messages in thread
[parent not found: <20150925134551.GE3568-fF5Pk5pvG8Y@public.gmane.org>]
* Re: [PATCH] edac: xgene: Fix possible sprintf overflow issue [not found] ` <20150925134551.GE3568-fF5Pk5pvG8Y@public.gmane.org> @ 2015-09-25 17:52 ` Loc Ho [not found] ` <CAPw-ZTmYEx9o39Xr_4wyQd_ZNhpQv6fmjsbmzw7J27+i2nADqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Loc Ho @ 2015-09-25 17:52 UTC (permalink / raw) To: Borislav Petkov Cc: Doug Thompson, Mauro Carvalho Chehab, Arnd Bergmann, Rob Herring, Mark Rutland, Ian Campbell, linux-edac, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Jon Masters, patches-qTEPVZfXA3Y@public.gmane.org Hi, > > All 5 applied. > > I've merged the last hunk changing xgene_edac_l3_create_debugfs_nodes > into the second patch which adds the L3 support. Thanks you... Next I would like to get the ACPI APEI supported. But unlike x86 which as NMI interface, APM hardware don't support this NMI interface. In order to make this works, we need an method to trigger the OS to indicate that the APEI table is available. For this, we are thinking about writing an separate APEI driver that wires up the IRQ to trigger the OS. Before we get going with this, I would like to run by you to see if you have any suggestion? -Loc -- 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] 4+ messages in thread
[parent not found: <CAPw-ZTmYEx9o39Xr_4wyQd_ZNhpQv6fmjsbmzw7J27+i2nADqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] edac: xgene: Fix possible sprintf overflow issue [not found] ` <CAPw-ZTmYEx9o39Xr_4wyQd_ZNhpQv6fmjsbmzw7J27+i2nADqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-09-26 8:38 ` Borislav Petkov 0 siblings, 0 replies; 4+ messages in thread From: Borislav Petkov @ 2015-09-26 8:38 UTC (permalink / raw) To: Loc Ho Cc: Doug Thompson, Mauro Carvalho Chehab, Arnd Bergmann, Rob Herring, Mark Rutland, Ian Campbell, linux-edac, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Jon Masters, patches-qTEPVZfXA3Y@public.gmane.org On Fri, Sep 25, 2015 at 10:52:23AM -0700, Loc Ho wrote: > Thanks you... Next I would like to get the ACPI APEI supported. But > unlike x86 which as NMI interface, APM hardware don't support this NMI > interface. In order to make this works, we need an method to trigger > the OS to indicate that the APEI table is available. For this, we are > thinking about writing an separate APEI driver that wires up the IRQ > to trigger the OS. Before we get going with this, I would like to run > by you to see if you have any suggestion? Well, AFAIR, there are efforts going on already for this on ARM64: https://lkml.kernel.org/r/1439555753-11974-1-git-send-email-fu.wei-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org Maybe test those first and possibly extend... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- 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] 4+ messages in thread
end of thread, other threads:[~2015-09-26 8:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 17:38 [PATCH] edac: xgene: Fix possible sprintf overflow issue Loc Ho
[not found] ` <1443116287-11752-1-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>
2015-09-25 13:45 ` Borislav Petkov
[not found] ` <20150925134551.GE3568-fF5Pk5pvG8Y@public.gmane.org>
2015-09-25 17:52 ` Loc Ho
[not found] ` <CAPw-ZTmYEx9o39Xr_4wyQd_ZNhpQv6fmjsbmzw7J27+i2nADqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-26 8:38 ` Borislav Petkov
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).