summaryrefslogtreecommitdiff
path: root/scsi.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-09-10 13:46:04 +0000
committerDmitry V. Levin <ldv@altlinux.org>2014-09-17 19:18:18 +0000
commit3ed5d021837768405d9f9c9e7d2b05dc6a110d94 (patch)
tree5f60485872e03d96717c68fe6ffa3959ca56a0a1 /scsi.c
parent2ed2cc743d1b06697f2b868eecb71df2f6a27ba8 (diff)
downloadstrace-3ed5d021837768405d9f9c9e7d2b05dc6a110d94.tar.gz
Fix compilation warnings reported by gcc -Wsign-compare
* configure.ac (gl_WARN_ADD): Add -Wsign-compare. * defs.h (struct tcb): Change 'currpers' type to unsigned. (struct xlat): Change 'val' type to unsigned (signame): Add 'const' qualifier to its argument. (xlookup, printxval): Add 'const' qualifier to the 2nd argument and change its type to unsigned. (printpathn): Change the 3rd argument type to unsigned. (ioctl_lookup): Change 1st argument type to unsigned. * count.c (call_summary_pers, call_summary): Change 'i' type to unsigned. * file.c (print_xattr_list): Fix comparisons between signed and unsigned long values. * ioctl.c (compare): Fix cast. (ioctl_lookup): Change 1st argument type to to unsigned. (ioctl_next_match): Change 'code' type to unsigned. * mem.c (sys_move_pages): Change 'i' type to unsigned. * mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned. Print 'i' using %u format string. * process.c (sys_prctl): Change 'i' type to unsigned. (printargv): Change 'n' type to unsigned. (sys_ptrace): Change 'addr' type to unsigned. * scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument and change its type to unsigned. Change 'i' and 'allocated' types to unsigned. * signal.c (signame): Add 'const' qualifier to its argument. Fix comparisons between signed and unsigned values. (sprintsigmask_n, printsiginfo): Fix comparisons between signed and unsigned values. * sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned. * strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned. (detach): Change 'sig' type to unsigned. (startup_attach): Change 'tcbi' type to unsigned. (startup_child): Change 'm', 'n', and 'len' types to unsigned. (init): Use new variable to iterate 'tcbtab'. (pid2tcb): Change 'i' type to unsigned. (cleanup): Change 'i' and 'sig' types to unsigned. * syscall.c (update_personality): Change 'personality' argument type to unsigned. (struct qual_options): Change 'bitflag' type to unsigned. (reallocate_qual): Add 'const' qualifier to its argument and change its type to unsigned. (qualify_one): Change 'n' and 'bitflag' arguments types to unsigned. Add 'const' qualifier to 'n', 'not', and 'pers' arguments. Change 'p' type to signed int. (qual_syscall): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. Change 'p' type to signed int. (qual_signal): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. Change 'i' type to unsigned. (qual_desc): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. (qualify): Change 'i' type to unsigned. (get_scno): Change 'currpers' type to unsigned. Fix a comparison between signed and unsigned values. * system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned. Fix comparisons between signed and unsigned values. * util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument and change its type to unsigned. (printuid): Fix a comparison between signed and unsigned values. (printpathn): Change 'n' argument type to unsigned. (printstr): Change 'size' type to unsigned. Fix a comparison between signed and unsigned values. (setbpt): Change 'i' type to unsigned. * net.c (printsock): Silence a compilation warning. * reboot.c (sys_reboot): Likewise.
Diffstat (limited to 'scsi.c')
-rw-r--r--scsi.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/scsi.c b/scsi.c
index 2aa4c7b35..a2e23c8b1 100644
--- a/scsi.c
+++ b/scsi.c
@@ -36,16 +36,15 @@
#include "xlat/sg_io_dxfer_direction.h"
static void
-print_sg_io_buffer(struct tcb *tcp, unsigned char *addr, int len)
+print_sg_io_buffer(struct tcb *tcp, unsigned char *addr, const unsigned int len)
{
unsigned char *buf = NULL;
- int allocated, i;
+ unsigned int allocated, i;
if (len == 0)
return;
allocated = (len > max_strlen) ? max_strlen : len;
- if (len < 0 ||
- (buf = malloc(allocated)) == NULL ||
+ if ((buf = malloc(allocated)) == NULL ||
umoven(tcp, (unsigned long) addr, allocated, (char *) buf) < 0) {
tprintf("%p", addr);
free(buf);