mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
3 minor fixups where sprintf() was used instead of snprintf() with
a known max length. Additionally the function return value is cast to void to make it explicit that the value is not needed. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@172 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
@@ -446,7 +446,7 @@ proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
||||
RETURN(-EINVAL);
|
||||
|
||||
spl_hostid = (long)val;
|
||||
sprintf(hw_serial, "%u", (val >= 0) ? val : -val);
|
||||
(void)snprintf(hw_serial, 11, "%u", (val >= 0) ? val : -val);
|
||||
*ppos += *lenp;
|
||||
} else {
|
||||
len = snprintf(str, sizeof(str), "%lx", spl_hostid);
|
||||
|
||||
@@ -161,18 +161,18 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
|
||||
vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd)
|
||||
{
|
||||
char *realpath;
|
||||
int rc;
|
||||
int len, rc;
|
||||
ENTRY;
|
||||
|
||||
ASSERT(vp == rootdir);
|
||||
|
||||
realpath = kmalloc(strlen(path) + 2, GFP_KERNEL);
|
||||
len = strlen(path) + 2;
|
||||
realpath = kmalloc(len, GFP_KERNEL);
|
||||
if (!realpath)
|
||||
RETURN(ENOMEM);
|
||||
|
||||
sprintf(realpath, "/%s", path);
|
||||
(void)snprintf(realpath, len, "/%s", path);
|
||||
rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2);
|
||||
|
||||
kfree(realpath);
|
||||
|
||||
RETURN(rc);
|
||||
|
||||
Reference in New Issue
Block a user