[OPW,kernel,v3,1/4] acpi: apei: Add timespec to timespec64 conversion
diff mbox

Message ID 1415123521-4564-2-git-send-email-somyaanand214@gmail.com
State New, archived
Headers show

Commit Message

Somya Anand Nov. 4, 2014, 5:51 p.m. UTC
32-bit systems using 'struct timespec' will break in the year 2038,
so we have to replace that code with more appropriate types.

Introducing a local variable of type 'struct timespec64' to update
interface of pstore_info.read in order to support new pstore_info API.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
Changes since version 1:
  * Use timespec64_to_timespec conversion.
  * Reword commit messag
 drivers/acpi/apei/erst.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Arnd Bergmann Nov. 4, 2014, 9:30 p.m. UTC | #1
On Tuesday 04 November 2014 23:21:58 Somya Anand wrote:
>  static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
> -                          struct timespec *time, char **buf,
> +                          struct timespec *ts, char **buf,
>                            bool *compressed, struct pstore_info *psi)
>  {
>         int rc;
> @@ -999,6 +999,8 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
>         u64 record_id;
>         struct cper_pstore_record *rcd;
>         size_t rcd_len = sizeof(*rcd) + erst_info.bufsize;
> +       struct timespec64 *time;
> +       struct timespec ts_temp;
>  
>         if (erst_disable)
>                 return -ENODEV;
> @@ -1056,6 +1058,8 @@ skip:
>         else
>                 time->tv_sec = 0;
>         time->tv_nsec = 0;
> +       ts_temp = timespec64_to_timespec(*time);
> +       ts = &ts_temp;
> 

Hi Somya,

This is unfortunately still wrong, you are not writing to structure
that gets passed into this function.

	Arnd

Patch
diff mbox

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index ed65e9c..30d3a9c 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -991,7 +991,7 @@  static int erst_close_pstore(struct pstore_info *psi)
 }
 
 static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
-			   struct timespec *time, char **buf,
+			   struct timespec *ts, char **buf,
 			   bool *compressed, struct pstore_info *psi)
 {
 	int rc;
@@ -999,6 +999,8 @@  static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
 	u64 record_id;
 	struct cper_pstore_record *rcd;
 	size_t rcd_len = sizeof(*rcd) + erst_info.bufsize;
+	struct timespec64 *time;
+	struct timespec ts_temp;
 
 	if (erst_disable)
 		return -ENODEV;
@@ -1056,6 +1058,8 @@  skip:
 	else
 		time->tv_sec = 0;
 	time->tv_nsec = 0;
+	ts_temp = timespec64_to_timespec(*time);
+	ts = &ts_temp;
 
 out:
 	kfree(rcd);