quoted
+ if (err)
+ goto err_files_mem;
Nit: ^^ two spaces here.
Removed.
quoted
+
+ if (file_set->count == LUO_FILE_MAX) {
+ err = -ENOSPC;
+ goto err_files_mem;
+ }
+
+ err = -ENOENT;
+ luo_list_for_each_private(fh, &luo_file_handler_list, list) {
+ if (fh->ops->can_preserve(fh, file)) {
+ err = 0;
+ break;
+ }
+ }
+
[...]
quoted
+int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
+{
+ struct liveupdate_file_handler *fh_iter;
+ int err;
+
+ if (!liveupdate_enabled())
+ return -EOPNOTSUPP;
+
+ /* Sanity check that all required callbacks are set */
+ if (!fh->ops->preserve || !fh->ops->unpreserve ||
+ !fh->ops->retrieve || !fh->ops->finish) {
You are still missing a check for can_preserve() here. It is a mandatory
callback and luo_preserve_file() calls it without checking for NULL.
Added.
With these and Mike's comments addressed,
Reviewed-by: Pratyush Yadav [off-list ref]
Thanks.
quoted
+ return -EINVAL;
+ }
+
[...]
--
Regards,
Pratyush Yadav