edac: xgene: Fix possible sprintf overflow issue
Subsystems (2)
PATCH 1/1 edac: xgene: Fix possible sprintf overflow issue
Replace sprintf with snprintf to avoid possible string array overflow.
--- drivers/edac/xgene_edac.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/edac/xgene_edac.c +3 -3
@@ -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 ;
Signature · 1 line
1.7.1
Borislav Petkov
maintainerPATCH 1/1 edac: xgene: Fix possible sprintf overflow issue
Quoted 30 lines · Loc Ho
Replace sprintf with snprintf to avoid possible string array overflow.
Signed-off-by Loc Ho <[email protected]>--- drivers/edac/xgene_edac.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/edac/xgene_edac.c +2
-2@@ -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 ());
drivers/edac/xgene_edac.c xgene_edac_l3_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev) · line 1189
Quoted 8 lines
drivers/edac/xgene_edac.c +1
-1@@ -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.
Signature · 4 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.PATCH 1/1 edac: xgene: Fix possible sprintf overflow issue
Hi,
Quoted 5 lines
All 5 applied.
I've merged the last hunk changing
xgene_edac_l3_create_debugfs_nodesinto 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
Borislav Petkov
maintainerPATCH 1/1 edac: xgene: Fix possible sprintf overflow issue
Quoted 7 lines · Loc Ho
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 at linaro.org
Maybe test those first and possibly extend...
Signature · 4 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.