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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 24 Nov 2016 13:23:51 +0530
From:   Nayna <nayna@...ux.vnet.ibm.com>
To:     Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc:     tpmdd-devel@...ts.sourceforge.net, peterhuewe@....de,
        tpmdd@...horst.net, jarkko.sakkinen@...ux.intel.com,
        linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/3] tpm: enhance read_log_of() to support Physical TPM
 event log



On 11/24/2016 01:07 AM, Jason Gunthorpe wrote:
> On Wed, Nov 23, 2016 at 12:27:36PM -0500, Nayna Jain wrote:
>>   	sizep = of_get_property(np, "linux,sml-size", NULL);
>> +	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
>> +		log_size = be32_to_cpup(sizep);
>> +	else
>> +		log_size = *sizep;
>> +
>
> Uh, no, sizep can be null at this point:

Oops !! Missed the basic. Will fix it. Sorry, and Thanks for noticing.

>
>>   	basep = of_get_property(np, "linux,sml-base", NULL);
>>   	if (sizep == NULL && basep == NULL)
>>   		return -ENODEV;
>>   	if (sizep == NULL || basep == NULL)
>>   		return -EIO;
>
> Move the if here.

Yeah..

>
>> -	if (*sizep == 0) {
>> +	if (log_size == 0) {
>>   		dev_warn(&chip->dev, "%s: Event log area empty\n", __func__);
>>   		return -EIO;
>>   	}
>>
>> -	log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
>> +	log->bios_event_log = kmalloc(log_size, GFP_KERNEL);
>>   	if (!log->bios_event_log)
>>   		return -ENOMEM;
>>
>> -	log->bios_event_log_end = log->bios_event_log + *sizep;
>> +	log->bios_event_log_end = log->bios_event_log + log_size;
>>
>> -	memcpy(log->bios_event_log, __va(*basep), *sizep);
>> +	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0)
>> +		memcpy(chip->log.bios_event_log, __va(be64_to_cpup(basep)),
>> +		       log_size);
>> +	else
>> +		memcpy(chip->log.bios_event_log, __va(*basep),
>> log_size);
>
> And move the conditional swap of basep up to be along side sizep as
> well (ie get rid of the second of_property_match_string)
>

Yeah.. true.. Will fix this also.

Thanks & Regards,
    - Nayna

> Jason
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ