Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/21025 )
Change subject: util/inteltool: Remove duplicated error message, switch to snprintf
......................................................................
util/inteltool: Remove duplicated error message, switch to snprintf
Passing a string containing output from strerror() to perror() causes
double error message display. It is also causing segfaults when the
error message is longer than temp_string capacity.
To fix the problems, sterror() call has been removed so the error
message is printed only once. This could be enough to avoid segfaults,
but it is a good practice to limit output size with snprintf().
Change-Id: I5ccc37e404f278cafae0a451c5acaa27d7907cce
Signed-off-by: Maciej Suminski <maciej.suminski(a)cern.ch>
Reviewed-on: https://review.coreboot.org/21025
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
---
M util/inteltool/cpu.c
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c
index 7b2e503..360b86b 100644
--- a/util/inteltool/cpu.c
+++ b/util/inteltool/cpu.c
@@ -117,14 +117,13 @@
*fd = open(dev, mode);
if (*fd < 0) {
- sprintf(temp_string,
- "open(\"%s\"): %s\n", dev, strerror(errno));
+ snprintf(temp_string, sizeof(temp_string), "open(\"%s\")", dev);
perror(temp_string);
return -1;
}
if (lseek(*fd, msr, SEEK_SET) == (off_t)-1) {
- sprintf(temp_string, "lseek(%lu): %s\n", msr, strerror(errno));
+ snprintf(temp_string, sizeof(temp_string), "lseek(%lu)", msr);
perror(temp_string);
close(*fd);
return -1;
@@ -141,7 +140,8 @@
char temp_string[50];
if (open_and_seek(cpu, addr, O_RDONLY, &fd) < 0) {
- sprintf(temp_string, "Could not read MSR for CPU#%d", cpu);
+ snprintf(temp_string, sizeof(temp_string),
+ "Could not read MSR for CPU#%d", cpu);
perror(temp_string);
}
@@ -194,13 +194,11 @@
#ifndef __DARWIN__
int ncpus = get_number_of_cpus();
int i = 0;
- char temp_string[50];
printf("\n============= Dumping INTEL SGX status =============");
if (ncpus < 1) {
- sprintf(temp_string, "Failed to get number of CPUs\n");
- perror(temp_string);
+ perror("Failed to get number of CPUs");
error = -1;
} else {
printf("\nNumber of CPUs = %d\n", ncpus);
--
To view, visit https://review.coreboot.org/21025
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5ccc37e404f278cafae0a451c5acaa27d7907cce
Gerrit-Change-Number: 21025
Gerrit-PatchSet: 6
Gerrit-Owner: Maciej Suminski <maciej.suminski(a)cern.ch>
Gerrit-Reviewer: Maciej Suminski <maciej.suminski(a)cern.ch>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Pratikkumar V Prajapati <pratikkumar.v.prajapati(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/20741 )
Change subject: mb/google/soraka: Camera PMIC runtime power control
......................................................................
Patch Set 8:
(3 comments)
https://review.coreboot.org/#/c/20741/8//COMMIT_MSG
Commit Message:
https://review.coreboot.org/#/c/20741/8//COMMIT_MSG@9
PS8, Line 9: PMIC(tps68470)
Please add a space before the `(`.
https://review.coreboot.org/#/c/20741/8/src/mainboard/google/poppy/acpi/mip…
File src/mainboard/google/poppy/acpi/mipi_camera.asl:
https://review.coreboot.org/#/c/20741/8/src/mainboard/google/poppy/acpi/mip…
PS8, Line 32: * Turn on 3V3_VDD. It takes around 1 ms
: * for volatge to settle to 3.3 Volt.
: * Provide additional 2 ms before we
: * enable regulators.
The allowed text width is longer.
https://review.coreboot.org/#/c/20741/8/src/mainboard/google/poppy/acpi/mip…
PS8, Line 59: * This reset is avoided in S3 & S0ix resume.
Do not reset PMIC in S3 & S0ix resume.
--
To view, visit https://review.coreboot.org/20741
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I23b0c0a887c9eb5d29b89f14aebba273b01228e0
Gerrit-Change-Number: 20741
Gerrit-PatchSet: 8
Gerrit-Owner: Naresh Solanki <naresh.solanki(a)intel.com>
Gerrit-Reviewer: Divagar Mohandass <divagar.mohandass(a)intel.corp-partner.google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Lakshmi G Prasad <lakshmi.g.prasad(a)intel.com>
Gerrit-Reviewer: Naresh Solanki <naresh.solanki(a)intel.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Rajmohan Mani <rajmohan.mani(a)intel.com>
Gerrit-Reviewer: Ricky Liang <jcliang(a)google.com>
Gerrit-Reviewer: Rizwan Qureshi <rizwan.qureshi(a)intel.com>
Gerrit-Reviewer: Tomasz Figa <tfiga(a)google.com>
Gerrit-Reviewer: V Sowmya <v.sowmya(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: rushikesh s kadam <rushikesh.s.kadam(a)intel.com>
Gerrit-Comment-Date: Tue, 22 Aug 2017 10:09:21 +0000
Gerrit-HasComments: Yes
Naresh Solanki has posted comments on this change. ( https://review.coreboot.org/20741 )
Change subject: mb/google/soraka: Camera PMIC runtime power control
......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/#/c/20741/8/src/mainboard/google/poppy/variants…
File src/mainboard/google/poppy/variants/soraka/gpio.c:
https://review.coreboot.org/#/c/20741/8/src/mainboard/google/poppy/variants…
PS8, Line 146: PAD_CFG_GPO(GPP_C11, 0, DEEP),
> Is there any update on this. We are currently waiting on this change to ver
1. Will update in poppy as well.
2. test are done except for power number.
@Rushikesh: Please update with power numbers.
--
To view, visit https://review.coreboot.org/20741
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I23b0c0a887c9eb5d29b89f14aebba273b01228e0
Gerrit-Change-Number: 20741
Gerrit-PatchSet: 8
Gerrit-Owner: Naresh Solanki <naresh.solanki(a)intel.com>
Gerrit-Reviewer: Divagar Mohandass <divagar.mohandass(a)intel.corp-partner.google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Lakshmi G Prasad <lakshmi.g.prasad(a)intel.com>
Gerrit-Reviewer: Naresh Solanki <naresh.solanki(a)intel.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Rajmohan Mani <rajmohan.mani(a)intel.com>
Gerrit-Reviewer: Ricky Liang <jcliang(a)google.com>
Gerrit-Reviewer: Rizwan Qureshi <rizwan.qureshi(a)intel.com>
Gerrit-Reviewer: Tomasz Figa <tfiga(a)google.com>
Gerrit-Reviewer: V Sowmya <v.sowmya(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: rushikesh s kadam <rushikesh.s.kadam(a)intel.com>
Gerrit-Comment-Date: Tue, 22 Aug 2017 09:26:54 +0000
Gerrit-HasComments: Yes