[syslinux] Missing Error Condition Check in core/fs/fs.c

Shao Miller Shao.Miller at yrdsb.edu.on.ca
Tue Aug 2 13:35:16 PDT 2011


On 8/2/2011 16:24, H. Peter Anvin wrote:
> On 08/02/2011 01:14 PM, Shao Miller wrote:
>>
>> From c9e609b14db68bed620aa911ed4f3587702d2dd3 Mon Sep 17 00:00:00 2001
>> From: Shao Miller <shao.miller at yrdsb.edu.on.ca>
>> Date: Tue, 2 Aug 2011 15:58:50 -0400
>> Subject: [PATCH] core: Run Nindent on core/fs/fs.c
>>
>> Signed-off-by: Shao Miller <shao.miller at yrdsb.edu.on.ca>
>> ---
>> core/fs/fs.c | 58
>> ++++++++++++++++++++++++++++------------------------------
>> 1 files changed, 28 insertions(+), 30 deletions(-)
>>
>> diff --git a/core/fs/fs.c b/core/fs/fs.c
>> index ad2fb37..95d747d 100644
>> --- a/core/fs/fs.c
>> +++ b/core/fs/fs.c
>> @@ -6,7 +6,7 @@
>> #include "cache.h"
>>
>> /* The currently mounted filesystem */
>> -struct fs_info *this_fs = NULL; /* Root filesystem */
>> +struct fs_info *this_fs = NULL; /* Root filesystem */
>>
>> /* Actual file structures (we don't have malloc yet...) */
>> struct file files[MAX_OPEN];
>> @@ -77,7 +77,7 @@ void _close_file(struct file *file)
>> * Convert between a 16-bit file handle and a file structure
>> */
>>
>> -void pm_load_config(com32sys_t *regs)
>> +void pm_load_config(com32sys_t * regs)
>
> This is really a bug in Nindent... there shouldn't be a space here.
>

I must respectfully disagree. :)  I certainly prefer the space there and 
am an advocate for it.  I thus thought 'Nindent' did it on purpose; heheh.

> Please don't run Nindent unless the formatting is *totally* screwed;
> automatic indentation usually creates more problems than it solves.

Ah, well that is good to know.  Will do.  Revision attached and below.

- Shao Miller

-----

 From efed7d37f4e89bb43ccd0d95c0bdbf3d570e73ba Mon Sep 17 00:00:00 2001
From: Shao Miller <shao.miller at yrdsb.edu.on.ca>
Date: Tue, 2 Aug 2011 16:31:50 -0400
Subject: [PATCH] core: Use kaboom in a couple of places

If we do not find a valid filesystem or if we do not
find a root directory, use kaboom() to terminate.

Signed-off-by: Shao Miller <shao.miller at yrdsb.edu.on.ca>
---
  core/fs/fs.c |    7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/fs/fs.c b/core/fs/fs.c
index ad2fb37..80687c2 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -457,8 +457,7 @@ void fs_init(com32sys_t *regs)
      }
      if (blk_shift < 0) {
      printf("No valid file system found!\n");
-    while (1)
-        ;
+        kaboom();
      }
      this_fs = &fs;

@@ -469,6 +468,10 @@ void fs_init(com32sys_t *regs)
      /* start out in the root directory */
      if (fs.fs_ops->iget_root) {
      fs.root = fs.fs_ops->iget_root(&fs);
+        if (!fs.root) {
+        printf("No root directory found!\n");
+        kaboom();
+    }
      fs.cwd = get_inode(fs.root);
      }

-- 
1.6.0.4

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-core-Use-kaboom-in-a-couple-of-places.patch
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20110802/c935b373/attachment.ksh>


More information about the Syslinux mailing list