Patchwork bios: mtrr: move buffer memset() to after failed is declared.

login
register
mail settings
Submitter Colin King
Date Dec. 7, 2012, 12:12 a.m.
Message ID <1354839164-6684-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/204353/
State Accepted
Headers show

Comments

Colin King - Dec. 7, 2012, 12:12 a.m.
From: Colin Ian King <colin.king@canonical.com>

the memset() on the buffer should be after all the variables are
declared to make it conform to the fwts house style.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/bios/mtrr/mtrr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Alex Hung - Dec. 13, 2012, 2:10 a.m.
On 12/07/2012 08:12 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> the memset() on the buffer should be after all the variables are
> declared to make it conform to the fwts house style.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 294e80b..e2ee506 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -249,9 +249,10 @@ static int validate_iomem(fwts_framework *fw)
>   	FILE *file;
>   	char buffer[4096];
>   	int pcidepth = 0;
> -	memset(buffer, 0, 4096);
>   	int failed = 0;
>
> +	memset(buffer, 0, 4096);
> +
>   	if ((file = fopen("/proc/iomem", "r")) == NULL)
>   		return FWTS_ERROR;
>
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - Dec. 13, 2012, 9:43 a.m.
On 12/07/2012 08:12 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> the memset() on the buffer should be after all the variables are
> declared to make it conform to the fwts house style.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 294e80b..e2ee506 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -249,9 +249,10 @@ static int validate_iomem(fwts_framework *fw)
>   	FILE *file;
>   	char buffer[4096];
>   	int pcidepth = 0;
> -	memset(buffer, 0, 4096);
>   	int failed = 0;
>
> +	memset(buffer, 0, 4096);
> +
>   	if ((file = fopen("/proc/iomem", "r")) == NULL)
>   		return FWTS_ERROR;
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
index 294e80b..e2ee506 100644
--- a/src/bios/mtrr/mtrr.c
+++ b/src/bios/mtrr/mtrr.c
@@ -249,9 +249,10 @@  static int validate_iomem(fwts_framework *fw)
 	FILE *file;
 	char buffer[4096];
 	int pcidepth = 0;
-	memset(buffer, 0, 4096);
 	int failed = 0;
 
+	memset(buffer, 0, 4096);
+
 	if ((file = fopen("/proc/iomem", "r")) == NULL)
 		return FWTS_ERROR;