Skip to contentSkip to conversation

xsm: fix printf format string for strlen result

PATCH In review Ian Campbell 3 participants 5 messages Apr 15, 2013 – Apr 30, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CAF1bEnyhhRfLB_RjwD7UuOY7W5oRTvJ6cb8TzxFanjJFcLC=Mg@mail.gmail.com

#1 lore raw

PATCH 1/1 xsm: fix printf format string for strlen result

strlen returns size_t:

policydb.c: In function ‘policydb_read’:
policydb.c:1779: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’

This is probably benign on 64-bit x86 but was found by Dharshini on 32-bit Xen 4.2.x. I expect it affects ARM too.

---
 xen/xsm/flask/ss/policydb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/xsm/flask/ss/policydb.c +1 -1
index fefcd59..bdec4ac 100644
@@ -1737,7 +1737,7 @@ int policydb_read(struct policydb *p, void *fp)
     if ( len != strlen(POLICYDB_STRING) )
     {
         printk(KERN_ERR "Flask:  policydb string length %d does not "
-               "match expected length %lu\n",
+               "match expected length %zu\n",
                len, strlen(POLICYDB_STRING));
         goto bad;
     }
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

Adding Keir + Jan.

Quoted 20 lines · Ian Campbell

strlen returns size_t:

policydb.c: In function ‘policydb_read’:
policydb.c:1779: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’

This is probably benign on 64-bit x86 but was found by Dharshini on 32-bit Xen 4.2.x. I expect it affects ARM too.

---
 xen/xsm/flask/ss/policydb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/xsm/flask/ss/policydb.c +0 -0
index fefcd59..bdec4ac 100644

xen/xsm/flask/ss/policydb.c int policydb_read(struct policydb *p, void *fp) · line 1743

Quoted 8 lines
xen/xsm/flask/ss/policydb.c +1 -1
@@ -1737,7 +1737,7 @@ int policydb_read(struct policydb *p, void *fp)
     if ( len != strlen(POLICYDB_STRING) )
     {
         printk(KERN_ERR "Flask:  policydb string length %d does not "
-               "match expected length %lu\n",
+               "match expected length %zu\n",
                len, strlen(POLICYDB_STRING));
         goto bad;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Adding Keir + Jan.

Would really be Daniel to give his ack here. It's a trivial enough change, so if I don't see an ack soon, I'll probably commit this anyway...

Jan

Quoted 18 lines · Ian Campbell
Quoted 4 lines

strlen returns size_t:

policydb.c: In function ‘policydb_read’:
policydb.c:1779: error: format ‘%lu’ expects type ‘long unsigned int’, but

argument 3 has type ‘size_t’

Quoted 2 lines

This is probably benign on 64-bit x86 but was found by Dharshini on 32-bit

Xen

Quoted 9 lines

4.2.x. I expect it affects ARM too.

---
 xen/xsm/flask/ss/policydb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

xen/xsm/flask/ss/policydb.c int policydb_read(struct policydb *p, void *fp) · line 1743

Quoted 13 lines
xen/xsm/flask/ss/policydb.c +1 -1
index fefcd59..bdec4ac 100644
@@ -1737,7 +1737,7 @@ int policydb_read(struct policydb *p, void *fp)
     if ( len != strlen(POLICYDB_STRING) )
     {
         printk(KERN_ERR "Flask:  policydb string length %d does not "
-               "match expected length %lu\n",
+               "match expected length %zu\n",
                len, strlen(POLICYDB_STRING));
         goto bad;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 8 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Adding Keir + Jan.

Would really be Daniel to give his ack here. It's a trivial enough change, so if I don't see an ack soon, I'll probably commit this anyway...

Jan

Ah, sorry about that, for some reason I didn't register that this was waiting for my Ack since it seemed like a trivial change.

Quoted 19 lines
Quoted 19 lines · Ian Campbell
Quoted 4 lines

strlen returns size_t:

policydb.c: In function ‘policydb_read’:
policydb.c:1779: error: format ‘%lu’ expects type ‘long unsigned int’, but

argument 3 has type ‘size_t’

Quoted 2 lines

This is probably benign on 64-bit x86 but was found by Dharshini on 32-bit

Xen

Quoted 9 lines

4.2.x. I expect it affects ARM too.

---
  xen/xsm/flask/ss/policydb.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/xsm/flask/ss/policydb.c +0 -0
index fefcd59..bdec4ac 100644
@@ -1737,7 +1737,7 @@ int policydb_read(struct policydb *p, void *fp)
Quoted 8 lines

xen/xsm/flask/ss/policydb.c int policydb_read(struct policydb *p, void *fp) · line 1743

Quoted 8 lines
xen/xsm/flask/ss/policydb.c +1 -1
      if ( len != strlen(POLICYDB_STRING) )
      {
          printk(KERN_ERR "Flask:  policydb string length %d does not "
-               "match expected length %lu\n",
+               "match expected length %zu\n",
                 len, strlen(POLICYDB_STRING));
          goto bad;
      }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Daniel De Graaf
Quoted 6 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Adding Keir + Jan.

Would really be Daniel to give his ack here. It's a trivial enough change, so if I don't see an ack soon, I'll probably commit this anyway...

Ah, sorry about that, for some reason I didn't register that this was waiting for my Ack since it seemed like a trivial change.

Trivial or not, the rule of thumb is that all patches should have an ack from a maintainer. Otherwise we're getting into the gray zone of determining where "trivial" ends. So while exceptions to this are possible, we're trying to limit them...

Jan