lib: fwts_log: make magic uint64_t to improve corruption checking

Message ID 20170906093403.23835-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • lib: fwts_log: make magic uint64_t to improve corruption checking
Related show

Commit Message

Colin King Sept. 6, 2017, 9:34 a.m.
From: Colin Ian King <colin.king@canonical.com>

Make the magic field 64 bits to ensure we have more magic bits to check
on for structure corruption checking.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_log.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Hung Sept. 7, 2017, 1:46 a.m. | #1
On 2017-09-06 02:34 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make the magic field 64 bits to ensure we have more magic bits to check
> on for structure corruption checking.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts_log.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h
> index 028ba36c..da8cb42b 100644
> --- a/src/lib/include/fwts_log.h
> +++ b/src/lib/include/fwts_log.h
> @@ -26,7 +26,7 @@
>   #include "fwts_framework.h"
>   #include "fwts_list.h"
>   
> -#define LOG_MAGIC		(0xfe23ab13)
> +#define LOG_MAGIC		(0xfe23ab13cb1ef754ULL)
>   #define LOG_MAX_BUF_SIZE	(4096)		/* Max output per log line */
>   
>   typedef enum {
> @@ -87,7 +87,7 @@ typedef enum {
>    *  top level log descriptor
>    */
>   typedef struct log_t {
> -	unsigned int magic;			/* magic ID of the log */
> +	uint64_t magic;				/* magic ID of the log */
>   	fwts_list log_files;			/* list of fwts_log_file */
>   	char *owner;				/* who is writing to this log */
>   } fwts_log;
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Sept. 21, 2017, 7:59 a.m. | #2
On 09/06/2017 05:34 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make the magic field 64 bits to ensure we have more magic bits to check
> on for structure corruption checking.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts_log.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h
> index 028ba36c..da8cb42b 100644
> --- a/src/lib/include/fwts_log.h
> +++ b/src/lib/include/fwts_log.h
> @@ -26,7 +26,7 @@
>   #include "fwts_framework.h"
>   #include "fwts_list.h"
>   
> -#define LOG_MAGIC		(0xfe23ab13)
> +#define LOG_MAGIC		(0xfe23ab13cb1ef754ULL)
>   #define LOG_MAX_BUF_SIZE	(4096)		/* Max output per log line */
>   
>   typedef enum {
> @@ -87,7 +87,7 @@ typedef enum {
>    *  top level log descriptor
>    */
>   typedef struct log_t {
> -	unsigned int magic;			/* magic ID of the log */
> +	uint64_t magic;				/* magic ID of the log */
>   	fwts_list log_files;			/* list of fwts_log_file */
>   	char *owner;				/* who is writing to this log */
>   } fwts_log;
> 

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

Patch

diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h
index 028ba36c..da8cb42b 100644
--- a/src/lib/include/fwts_log.h
+++ b/src/lib/include/fwts_log.h
@@ -26,7 +26,7 @@ 
 #include "fwts_framework.h"
 #include "fwts_list.h"
 
-#define LOG_MAGIC		(0xfe23ab13)
+#define LOG_MAGIC		(0xfe23ab13cb1ef754ULL)
 #define LOG_MAX_BUF_SIZE	(4096)		/* Max output per log line */
 
 typedef enum {
@@ -87,7 +87,7 @@  typedef enum {
  *  top level log descriptor
  */
 typedef struct log_t {
-	unsigned int magic;			/* magic ID of the log */
+	uint64_t magic;				/* magic ID of the log */
 	fwts_list log_files;			/* list of fwts_log_file */
 	char *owner;				/* who is writing to this log */
 } fwts_log;