Commit 6078e0bef2236f323377c53e77e26288fb52ee23

Authored by Sudeep Dutt
Committed by Greg Kroah-Hartman
1 parent af68fb6555

misc: mic: Fix build issues in sample daemon.

Specifying gcc format function attribute for mpsslog(..) and
building on 32 bit systems exposed a few build issues in the
sample MIC daemon which are fixed by this patch. Some of these
changes were authored by Joe Perches @
https://lkml.org/lkml/2013/9/27/419

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Caz Yokoyama <Caz.Yokoyama@intel.com>
Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 12 additions and 11 deletions Side-by-side Diff

Documentation/mic/mpssd/mpssd.c
... ... @@ -362,9 +362,9 @@
362 362 struct mic_copy_desc *copy)
363 363 {
364 364 if (copy->out_len != sum_iovec_len(copy)) {
365   - mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%x\n",
  365 + mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%zx\n",
366 366 mic->name, __func__, __LINE__,
367   - copy->out_len, sum_iovec_len(copy));
  367 + copy->out_len, sum_iovec_len(copy));
368 368 assert(copy->out_len == sum_iovec_len(copy));
369 369 }
370 370 }
... ... @@ -377,7 +377,7 @@
377 377 int i;
378 378  
379 379 for (i = 0; i < copy->iovcnt; i++)
380   - mpsslog("%s %s %d copy->iov[%d] addr %p len 0x%lx\n",
  380 + mpsslog("%s %s %d copy->iov[%d] addr %p len 0x%zx\n",
381 381 mic->name, s, line, i,
382 382 copy->iov[i].iov_base, copy->iov[i].iov_len);
383 383 }
... ... @@ -630,7 +630,7 @@
630 630 disp_iovec(mic, &copy, __func__, __LINE__);
631 631 mpsslog("%s %s %d read failed %s ", mic->name,
632 632 __func__, __LINE__, strerror(errno));
633   - mpsslog("cnt %d sum %d\n",
  633 + mpsslog("cnt %d sum %zd\n",
634 634 copy.iovcnt, sum_iovec_len(&copy));
635 635 }
636 636 }
... ... @@ -680,8 +680,8 @@
680 680 if (len != sum_iovec_len(&copy)) {
681 681 mpsslog("Tun write failed %s ",
682 682 strerror(errno));
683   - mpsslog("len 0x%x ", len);
684   - mpsslog("read_len 0x%x\n",
  683 + mpsslog("len 0x%zx ", len);
  684 + mpsslog("read_len 0x%zx\n",
685 685 sum_iovec_len(&copy));
686 686 } else {
687 687 #ifdef DEBUG
... ... @@ -827,7 +827,7 @@
827 827 mpsslog("%s %s %d read failed %s ",
828 828 mic->name, __func__, __LINE__,
829 829 strerror(errno));
830   - mpsslog("cnt %d sum %d\n",
  830 + mpsslog("cnt %d sum %zd\n",
831 831 copy.iovcnt, sum_iovec_len(&copy));
832 832 }
833 833 }
... ... @@ -859,8 +859,8 @@
859 859 if (len != sum_iovec_len(&copy)) {
860 860 mpsslog("Tun write failed %s ",
861 861 strerror(errno));
862   - mpsslog("len 0x%x ", len);
863   - mpsslog("read_len 0x%x\n",
  862 + mpsslog("len 0x%zx ", len);
  863 + mpsslog("read_len 0x%zx\n",
864 864 sum_iovec_len(&copy));
865 865 } else {
866 866 #ifdef DEBUG
... ... @@ -953,7 +953,7 @@
953 953 return false;
954 954 mic->mic_virtblk.backend_file = malloc(strlen(evv) + 1);
955 955 if (mic->mic_virtblk.backend_file == NULL) {
956   - mpsslog("can't allocate memory\n", mic->name, mic->id);
  956 + mpsslog("%s %d can't allocate memory\n", mic->name, mic->id);
957 957 return false;
958 958 }
959 959 strcpy(mic->mic_virtblk.backend_file, evv + 1);
... ... @@ -1026,7 +1026,7 @@
1026 1026 static bool
1027 1027 start_virtblk(struct mic_info *mic, struct mic_vring *vring)
1028 1028 {
1029   - if (((__u64)&virtblk_dev_page.blk_config % 8) != 0) {
  1029 + if (((unsigned long)&virtblk_dev_page.blk_config % 8) != 0) {
1030 1030 mpsslog("%s: blk_config is not 8 byte aligned.\n",
1031 1031 mic->name);
1032 1032 return false;
Documentation/mic/mpssd/mpssd.h
... ... @@ -94,6 +94,7 @@
94 94 struct mic_info *next;
95 95 };
96 96  
  97 +__attribute__((format(printf, 1, 2)))
97 98 void mpsslog(char *format, ...);
98 99 char *readsysfs(char *dir, char *entry);
99 100 int setsysfs(char *dir, char *entry, char *value);