return 0;
 }
 
-static size_t erst_reader(u64 *id, enum pstore_type_id *type,
+static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
                       struct timespec *time);
 static u64 erst_writer(enum pstore_type_id type, size_t size);
 
        char data[];
 } __packed;
 
-static size_t erst_reader(u64 *id, enum pstore_type_id *type,
+static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
                       struct timespec *time)
 {
        int rc;
 
 void pstore_get_records(void)
 {
        struct pstore_info *psi = psinfo;
-       size_t                  size;
+       ssize_t                 size;
        u64                     id;
        enum pstore_type_id     type;
        struct timespec         time;
 
        mutex_lock(&psinfo->buf_mutex);
        while ((size = psi->read(&id, &type, &time)) > 0) {
-               if (pstore_mkfile(type, psi->name, id, psi->buf, size,
+               if (pstore_mkfile(type, psi->name, id, psi->buf, (size_t)size,
                                  time, psi->erase))
                        failed++;
        }
 
        struct mutex    buf_mutex;      /* serialize access to 'buf' */
        char            *buf;
        size_t          bufsize;
-       size_t          (*read)(u64 *id, enum pstore_type_id *type,
+       ssize_t         (*read)(u64 *id, enum pstore_type_id *type,
                        struct timespec *time);
        u64             (*write)(enum pstore_type_id type, size_t size);
        int             (*erase)(u64 id);