* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
#include <linux/sched.h>
+#ifdef HAVE_SCHED_HEADERS
+#include <linux/sched/signal.h>
+#include <linux/sched/mm.h>
+#endif
#include <linux/fs_struct.h>
-
+#include <linux/pagemap.h>
#include <linux/compat.h>
#include <linux/thread_info.h>
!memcmp(entry, key, key_len)) {
entry += key_len + 1;
entry_len -= key_len + 1;
- /* The 'value' buffer passed in is too small.*/
- if (entry_len >= *val_len)
+
+ /* The 'value' buffer passed in is too small.
+ * Copy what fits, but return -EOVERFLOW. */
+ if (entry_len >= *val_len) {
+ memcpy(value, entry, *val_len);
+ value[*val_len - 1] = 0;
GOTO(out, rc = -EOVERFLOW);
+ }
memcpy(value, entry, entry_len);
*val_len = entry_len;