]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: fix the issue of sqlite3 integer bind parameter mismatch
authorXiaofei Tan <tanxiaofei@huawei.com>
Thu, 8 Aug 2019 02:14:30 +0000 (10:14 +0800)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 10 Oct 2019 17:30:39 +0000 (14:30 -0300)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
ras-record.c

index 30c063b9e91f88158c34b915f15cd77d1576e261..ae5d359c2daa20199a678b93356de4f96b20521d 100644 (file)
@@ -83,9 +83,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)
@@ -231,7 +231,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);