lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ndhwbqwpuu2p6i.fsf@rasscmlmus001.pdx.intel.com>
Date:	Sat, 10 Oct 2015 18:01:57 -0700
From:	Ashutosh Dixit <ashutosh.dixit@...el.com>
To:	Geliang Tang <geliangtang@....com>
Cc:	Joe Perches <joe@...ches.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Dutt\, Sudeep" <sudeep.dutt@...el.com>,
	"Rao\, Nikhil" <nikhil.rao@...el.com>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] misc: mic: use kstrdup() in cosm_sysfs

On Sat, Oct 10 2015 at 12:14:30 PM, Joe Perches <joe@...ches.com> wrote:
> On Sat, 2015-10-10 at 04:46 -0700, Geliang Tang wrote:
>> Use kstrdup instead of kmalloc and strncpy.
>
>> diff --git a/drivers/misc/mic/cosm/cosm_sysfs.c b/drivers/misc/mic/cosm/cosm_sysfs.c
> []
>> @@ -211,18 +211,14 @@ cmdline_store(struct device *dev, struct device_attribute *attr,
>>  	mutex_lock(&cdev->cosm_mutex);
>>  	kfree(cdev->cmdline);
>>
>> -	cdev->cmdline = kmalloc(count + 1, GFP_KERNEL);
>> +	cdev->cmdline = kstrdup(buf, GFP_KERNEL);
>>
> As count is a function argument, this isn't the same code.
>
Correct, is this code safe for unterminated strings from user land?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ