From: Frank Rowand <frank.row...@sonymobile.com>

Check for NULL pos before dereferencing it in srcpos_string().

Signed-off-by: Frank Rowand <frank.row...@sonymobile.com>
---
 srcpos.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/srcpos.c
===================================================================
--- a/srcpos.c
+++ b/srcpos.c
@@ -268,11 +268,13 @@ srcpos_string(struct srcpos *pos)
        char *pos_str;
        int rc;
 
-       if (pos)
+       if (pos && pos->file)
                fname = pos->file->name;
 
 
-       if (pos->first_line != pos->last_line)
+       if (!pos)
+               rc = asprintf(&pos_str, "%s:<no-line>", fname);
+       else if (pos->first_line != pos->last_line)
                rc = asprintf(&pos_str, "%s:%d.%d-%d.%d", fname,
                              pos->first_line, pos->first_column,
                              pos->last_line, pos->last_column);
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" 
in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to