extern int ima_file_hash(struct file *file, char *buf, size_t buf_size);
 extern int ima_inode_hash(struct inode *inode, char *buf, size_t buf_size);
 extern void ima_kexec_cmdline(int kernel_fd, const void *buf, int size);
-extern void ima_measure_critical_data(const char *event_label,
-                                     const char *event_name,
-                                     const void *buf, size_t buf_len,
-                                     bool hash);
+extern int ima_measure_critical_data(const char *event_label,
+                                    const char *event_name,
+                                    const void *buf, size_t buf_len,
+                                    bool hash);
 
 #ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
 extern void ima_appraise_parse_cmdline(void);
 
 static inline void ima_kexec_cmdline(int kernel_fd, const void *buf, int size) {}
 
-static inline void ima_measure_critical_data(const char *event_label,
+static inline int ima_measure_critical_data(const char *event_label,
                                             const char *event_name,
                                             const void *buf, size_t buf_len,
-                                            bool hash) {}
+                                            bool hash)
+{
+       return -ENOENT;
+}
 
 #endif /* CONFIG_IMA */
 
 
                           struct evm_ima_xattr_data *xattr_value,
                           int xattr_len, const struct modsig *modsig, int pcr,
                           struct ima_template_desc *template_desc);
-void process_buffer_measurement(struct user_namespace *mnt_userns,
-                               struct inode *inode, const void *buf, int size,
-                               const char *eventname, enum ima_hooks func,
-                               int pcr, const char *func_data,
-                               bool buf_hash);
+int process_buffer_measurement(struct user_namespace *mnt_userns,
+                              struct inode *inode, const void *buf, int size,
+                              const char *eventname, enum ima_hooks func,
+                              int pcr, const char *func_data,
+                              bool buf_hash);
 void ima_audit_measurement(struct integrity_iint_cache *iint,
                           const unsigned char *filename);
 int ima_alloc_init_template(struct ima_event_data *event_data,
 
        return 0;
 }
 
-/*
+/**
  * process_buffer_measurement - Measure the buffer or the buffer data hash
  * @mnt_userns:        user namespace of the mount the inode was found from
  * @inode: inode associated with the object being measured (NULL for KEY_CHECK)
  * @buf_hash: measure buffer data hash
  *
  * Based on policy, either the buffer data or buffer data hash is measured
+ *
+ * Return: 0 if the buffer has been successfully measured, a negative value
+ * otherwise.
  */
-void process_buffer_measurement(struct user_namespace *mnt_userns,
-                               struct inode *inode, const void *buf, int size,
-                               const char *eventname, enum ima_hooks func,
-                               int pcr, const char *func_data,
-                               bool buf_hash)
+int process_buffer_measurement(struct user_namespace *mnt_userns,
+                              struct inode *inode, const void *buf, int size,
+                              const char *eventname, enum ima_hooks func,
+                              int pcr, const char *func_data,
+                              bool buf_hash)
 {
        int ret = 0;
        const char *audit_cause = "ENOMEM";
        u32 secid;
 
        if (!ima_policy_flag)
-               return;
+               return -ENOENT;
 
        template = ima_template_desc_buf();
        if (!template) {
                                        secid, 0, func, &pcr, &template,
                                        func_data);
                if (!(action & IMA_MEASURE))
-                       return;
+                       return -ENOENT;
        }
 
        if (!pcr)
                                        func_measure_str(func),
                                        audit_cause, ret, 0, ret);
 
-       return;
+       return ret;
 }
 
 /**
  * and extend the pcr.  Examples of critical data could be various data
  * structures, policies, and states stored in kernel memory that can
  * impact the integrity of the system.
+ *
+ * Return: 0 if the buffer has been successfully measured, a negative value
+ * otherwise.
  */
-void ima_measure_critical_data(const char *event_label,
-                              const char *event_name,
-                              const void *buf, size_t buf_len,
-                              bool hash)
+int ima_measure_critical_data(const char *event_label,
+                             const char *event_name,
+                             const void *buf, size_t buf_len,
+                             bool hash)
 {
        if (!event_name || !event_label || !buf || !buf_len)
-               return;
+               return -ENOPARAM;
 
-       process_buffer_measurement(&init_user_ns, NULL, buf, buf_len, event_name,
-                                  CRITICAL_DATA, 0, event_label,
-                                  hash);
+       return process_buffer_measurement(&init_user_ns, NULL, buf, buf_len,
+                                         event_name, CRITICAL_DATA, 0,
+                                         event_label, hash);
 }
 
 static int __init init_ima(void)