Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: src/platform/vboot_reference/vkernel/kernel_image.c

Issue 2353001: random cleanup (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/vboot_reference/vfirmware/firmware_image.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/vkernel/kernel_image.c
diff --git a/src/platform/vboot_reference/vkernel/kernel_image.c b/src/platform/vboot_reference/vkernel/kernel_image.c
index e0b7a55d79c6bba2778e48bf228773aa0077e1e6..bda016553609cc23e8a8d7640f063af8d6997594 100644
--- a/src/platform/vboot_reference/vkernel/kernel_image.c
+++ b/src/platform/vboot_reference/vkernel/kernel_image.c
@@ -333,7 +333,7 @@ int WriteKernelImage(const char* output_file,
if (!image)
return 0;
- if (-1 == (fd = creat(output_file, S_IRWXU))) {
+ if (-1 == (fd = creat(output_file, 0666))) {
debug("Couldn't open file for writing kernel image: %s\n",
output_file);
return 0;
@@ -669,8 +669,11 @@ uint8_t* GenerateKernelBlob(const char* kernel_file,
config_buf = BufferFromFile(config_file, &config_size);
if (!config_buf)
goto done1;
- if (config_size < CROS_CONFIG_SIZE) // need room for trailing '\0'
+ if (config_size >= CROS_CONFIG_SIZE) { // need room for trailing '\0'
+ error("config file %s is too large (>= %d bytes)\n",
+ config_file, CROS_CONFIG_SIZE);
goto done1;
+ }
// Replace any newlines with spaces in the config file.
for (i=0; i < config_size; i++)
@@ -695,8 +698,10 @@ uint8_t* GenerateKernelBlob(const char* kernel_file,
CROS_PARAMS_SIZE +
roundup(bootloader_size, CROS_ALIGN);
blob = (uint8_t *)Malloc(blob_size);
- if (!blob)
+ if (!blob) {
+ error("Couldn't allocate %ld bytes.\n", blob_size);
goto done3;
+ }
Memset(blob, 0, blob_size);
now = 0;
« no previous file with comments | « src/platform/vboot_reference/vfirmware/firmware_image.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698