diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2013-07-08 21:25:12 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2013-07-08 21:25:12 +0000 |
| commit | 335349690f4c649c2fa99feed40ee2d2f7a088fa (patch) | |
| tree | 060f342f7e42541239236a5072f1e3bd4fcda99e /sys/ofed/include/linux | |
| parent | c64bc3a0766369e0bd5ac08a17b27cba6c78a99e (diff) | |
Notes
Diffstat (limited to 'sys/ofed/include/linux')
| -rw-r--r-- | sys/ofed/include/linux/sysfs.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/ofed/include/linux/sysfs.h b/sys/ofed/include/linux/sysfs.h index 698f75e1d3f9..ca2d71eda114 100644 --- a/sys/ofed/include/linux/sysfs.h +++ b/sys/ofed/include/linux/sysfs.h @@ -104,10 +104,15 @@ sysctl_handle_attr(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, buf, len); if (error || !req->newptr || ops->store == NULL) goto out; - error = SYSCTL_IN(req, buf, PAGE_SIZE); + len = req->newlen - req->newidx; + if (len >= PAGE_SIZE) + error = EINVAL; + else + error = SYSCTL_IN(req, buf, len); if (error) goto out; - len = ops->store(kobj, attr, buf, req->newlen); + ((char *)buf)[len] = '\0'; + len = ops->store(kobj, attr, buf, len); if (len < 0) error = -len; out: |
