Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch
@ 2019-08-08  2:14 Xiaofei Tan
  2019-10-10 17:31 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaofei Tan @ 2019-08-08  2:14 UTC (permalink / raw)
  To: mchehab, linux-edac; +Cc: Xiaofei Tan, linuxarm, shiju.jose

Some interger fields of arm_event and mc_event are 8 bytes width,
and sqlite3_bind_int64() should be used when restore the event to
sqlite3. But we use sqlite3_bind_int() in current code. This will
lead to an wrong value in sqlite3 DB.

This patch is to fix the issue.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 ras-record.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ras-record.c b/ras-record.c
index 4c8b55b..0bf0080 100644
--- a/ras-record.c
+++ b/ras-record.c
@@ -94,9 +94,9 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev)
 	sqlite3_bind_int (priv->stmt_mc_event,  7, ev->top_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  8, ev->middle_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  9, ev->lower_layer);
-	sqlite3_bind_int (priv->stmt_mc_event, 10, ev->address);
-	sqlite3_bind_int (priv->stmt_mc_event, 11, ev->grain);
-	sqlite3_bind_int (priv->stmt_mc_event, 12, ev->syndrome);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 10, ev->address);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 11, ev->grain);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 12, ev->syndrome);
 	sqlite3_bind_text(priv->stmt_mc_event, 13, ev->driver_detail, -1, NULL);
 	rc = sqlite3_step(priv->stmt_mc_event);
 	if (rc != SQLITE_OK && rc != SQLITE_DONE)
@@ -242,7 +242,7 @@ int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev)
 	sqlite3_bind_text (priv->stmt_arm_record,  1,  ev->timestamp, -1, NULL);
 	sqlite3_bind_int  (priv->stmt_arm_record,  2,  ev->error_count);
 	sqlite3_bind_int  (priv->stmt_arm_record,  3,  ev->affinity);
-	sqlite3_bind_int  (priv->stmt_arm_record,  4,  ev->mpidr);
+	sqlite3_bind_int64  (priv->stmt_arm_record,  4,  ev->mpidr);
 	sqlite3_bind_int  (priv->stmt_arm_record,  5,  ev->running_state);
 	sqlite3_bind_int  (priv->stmt_arm_record,  6,  ev->psci_state);
 
-- 
2.8.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch
  2019-08-08  2:14 [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch Xiaofei Tan
@ 2019-10-10 17:31 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2019-10-10 17:31 UTC (permalink / raw)
  To: Xiaofei Tan; +Cc: linux-edac, linuxarm, shiju.jose

Em Thu, 8 Aug 2019 10:14:30 +0800
Xiaofei Tan <tanxiaofei@huawei.com> escreveu:

> Some interger fields of arm_event and mc_event are 8 bytes width,
> and sqlite3_bind_int64() should be used when restore the event to
> sqlite3. But we use sqlite3_bind_int() in current code. This will
> lead to an wrong value in sqlite3 DB.
> 
> This patch is to fix the issue.
> 
> Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>

Applied, thanks!

> ---
>  ras-record.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/ras-record.c b/ras-record.c
> index 4c8b55b..0bf0080 100644
> --- a/ras-record.c
> +++ b/ras-record.c
> @@ -94,9 +94,9 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev)
>  	sqlite3_bind_int (priv->stmt_mc_event,  7, ev->top_layer);
>  	sqlite3_bind_int (priv->stmt_mc_event,  8, ev->middle_layer);
>  	sqlite3_bind_int (priv->stmt_mc_event,  9, ev->lower_layer);
> -	sqlite3_bind_int (priv->stmt_mc_event, 10, ev->address);
> -	sqlite3_bind_int (priv->stmt_mc_event, 11, ev->grain);
> -	sqlite3_bind_int (priv->stmt_mc_event, 12, ev->syndrome);
> +	sqlite3_bind_int64 (priv->stmt_mc_event, 10, ev->address);
> +	sqlite3_bind_int64 (priv->stmt_mc_event, 11, ev->grain);
> +	sqlite3_bind_int64 (priv->stmt_mc_event, 12, ev->syndrome);
>  	sqlite3_bind_text(priv->stmt_mc_event, 13, ev->driver_detail, -1, NULL);
>  	rc = sqlite3_step(priv->stmt_mc_event);
>  	if (rc != SQLITE_OK && rc != SQLITE_DONE)
> @@ -242,7 +242,7 @@ int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev)
>  	sqlite3_bind_text (priv->stmt_arm_record,  1,  ev->timestamp, -1, NULL);
>  	sqlite3_bind_int  (priv->stmt_arm_record,  2,  ev->error_count);
>  	sqlite3_bind_int  (priv->stmt_arm_record,  3,  ev->affinity);
> -	sqlite3_bind_int  (priv->stmt_arm_record,  4,  ev->mpidr);
> +	sqlite3_bind_int64  (priv->stmt_arm_record,  4,  ev->mpidr);
>  	sqlite3_bind_int  (priv->stmt_arm_record,  5,  ev->running_state);
>  	sqlite3_bind_int  (priv->stmt_arm_record,  6,  ev->psci_state);
>  



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch
@ 2019-09-02  8:38 tanxiaofei
  0 siblings, 0 replies; 4+ messages in thread
From: tanxiaofei @ 2019-09-02  8:38 UTC (permalink / raw)
  To: mchehab, linux-edac; +Cc: Linuxarm, Shiju Jose

Hi Mchehab, 
Could you please review this patch? Thanks..

.....

Some interger fields of arm_event and mc_event are 8 bytes width, and sqlite3_bind_int64() should be used when restore the event to sqlite3. But we use sqlite3_bind_int() in current code. This will lead to an wrong value in sqlite3 DB.

This patch is to fix the issue.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 ras-record.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ras-record.c b/ras-record.c index 4c8b55b..0bf0080 100644
--- a/ras-record.c
+++ b/ras-record.c
@@ -94,9 +94,9 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev)
 	sqlite3_bind_int (priv->stmt_mc_event,  7, ev->top_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  8, ev->middle_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  9, ev->lower_layer);
-	sqlite3_bind_int (priv->stmt_mc_event, 10, ev->address);
-	sqlite3_bind_int (priv->stmt_mc_event, 11, ev->grain);
-	sqlite3_bind_int (priv->stmt_mc_event, 12, ev->syndrome);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 10, ev->address);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 11, ev->grain);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 12, ev->syndrome);
 	sqlite3_bind_text(priv->stmt_mc_event, 13, ev->driver_detail, -1, NULL);
 	rc = sqlite3_step(priv->stmt_mc_event);
 	if (rc != SQLITE_OK && rc != SQLITE_DONE) @@ -242,7 +242,7 @@ int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev)
 	sqlite3_bind_text (priv->stmt_arm_record,  1,  ev->timestamp, -1, NULL);
 	sqlite3_bind_int  (priv->stmt_arm_record,  2,  ev->error_count);
 	sqlite3_bind_int  (priv->stmt_arm_record,  3,  ev->affinity);
-	sqlite3_bind_int  (priv->stmt_arm_record,  4,  ev->mpidr);
+	sqlite3_bind_int64  (priv->stmt_arm_record,  4,  ev->mpidr);
 	sqlite3_bind_int  (priv->stmt_arm_record,  5,  ev->running_state);
 	sqlite3_bind_int  (priv->stmt_arm_record,  6,  ev->psci_state);
 
--
2.8.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch
@ 2019-08-07  7:54 Xiaofei Tan
  0 siblings, 0 replies; 4+ messages in thread
From: Xiaofei Tan @ 2019-08-07  7:54 UTC (permalink / raw)
  To: mchehab, linux-edac; +Cc: Xiaofei Tan, linuxarm, shiju.jose

Some interger fields of arm_event and mc_event are 8 bytes width,
and sqlite3_bind_int64() should be used when restore the event to
sqlite3. But we use sqlite3_bind_int() in current code. This will
lead to an wrong value in sqlite3 DB.

This patch is to fix the issue.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 ras-record.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ras-record.c b/ras-record.c
index 4c8b55b..0bf0080 100644
--- a/ras-record.c
+++ b/ras-record.c
@@ -94,9 +94,9 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev)
 	sqlite3_bind_int (priv->stmt_mc_event,  7, ev->top_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  8, ev->middle_layer);
 	sqlite3_bind_int (priv->stmt_mc_event,  9, ev->lower_layer);
-	sqlite3_bind_int (priv->stmt_mc_event, 10, ev->address);
-	sqlite3_bind_int (priv->stmt_mc_event, 11, ev->grain);
-	sqlite3_bind_int (priv->stmt_mc_event, 12, ev->syndrome);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 10, ev->address);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 11, ev->grain);
+	sqlite3_bind_int64 (priv->stmt_mc_event, 12, ev->syndrome);
 	sqlite3_bind_text(priv->stmt_mc_event, 13, ev->driver_detail, -1, NULL);
 	rc = sqlite3_step(priv->stmt_mc_event);
 	if (rc != SQLITE_OK && rc != SQLITE_DONE)
@@ -242,7 +242,7 @@ int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev)
 	sqlite3_bind_text (priv->stmt_arm_record,  1,  ev->timestamp, -1, NULL);
 	sqlite3_bind_int  (priv->stmt_arm_record,  2,  ev->error_count);
 	sqlite3_bind_int  (priv->stmt_arm_record,  3,  ev->affinity);
-	sqlite3_bind_int  (priv->stmt_arm_record,  4,  ev->mpidr);
+	sqlite3_bind_int64  (priv->stmt_arm_record,  4,  ev->mpidr);
 	sqlite3_bind_int  (priv->stmt_arm_record,  5,  ev->running_state);
 	sqlite3_bind_int  (priv->stmt_arm_record,  6,  ev->psci_state);
 
-- 
2.8.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  2:14 [PATCH 1/1] rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch Xiaofei Tan
2019-10-10 17:31 ` Mauro Carvalho Chehab
  -- strict thread matches above, loose matches on Subject: below --
2019-09-02  8:38 tanxiaofei
2019-08-07  7:54 Xiaofei Tan

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org linux-edac@archiver.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/ public-inbox