From patchwork Tue Feb 9 01:44:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQj86fZ9z9sSC for ; Tue, 9 Feb 2021 12:46:20 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQj80F0BzDsZ5 for ; Tue, 9 Feb 2021 12:46:18 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhJ2lfLzDvYx for ; Tue, 9 Feb 2021 12:45:36 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 82956AE80211; Mon, 8 Feb 2021 20:45:03 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:46 +1100 Message-Id: <20210209014457.108301-2-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 01/12] libc: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * replaced cast to int with cast to size_t --- lib/libc/stdio/vsnprintf.c | 13 +++++++------ lib/libc/string/memmove.c | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c index 21dd04dfe46f..12f30439886d 100644 --- a/lib/libc/stdio/vsnprintf.c +++ b/lib/libc/stdio/vsnprintf.c @@ -25,14 +25,14 @@ static int print_str_fill(char **buffer, size_t bufsize, char *sizec, const char *str, char c) { - int i, sizei, len; + unsigned i, sizei, len; char *bstart = *buffer; sizei = strtoul(sizec, NULL, 10); len = strlen(str); if (sizei > len) { for (i = 0; - (i < (sizei - len)) && ((*buffer - bstart) < bufsize); + (i < (sizei - len)) && ((size_t)(*buffer - bstart) < bufsize); i++) { **buffer = c; *buffer += 1; @@ -47,7 +47,7 @@ print_str(char **buffer, size_t bufsize, const char *str) char *bstart = *buffer; size_t i; - for (i = 0; (i < strlen(str)) && ((*buffer - bstart) < bufsize); i++) { + for (i = 0; (i < strlen(str)) && ((size_t)(*buffer - bstart) < bufsize); i++) { **buffer = str[i]; *buffer += 1; } @@ -112,7 +112,7 @@ print_fill(char **buffer, size_t bufsize, char *sizec, unsigned long size, len = print_intlen(size, base) + optlen; if (sizei > len) { for (i = 0; - (i < (sizei - len)) && ((*buffer - bstart) < bufsize); + (i < (sizei - len)) && ((size_t)(*buffer - bstart) < bufsize); i++) { **buffer = c; *buffer += 1; @@ -143,7 +143,7 @@ print_format(char **buffer, size_t bufsize, const char *format, void *var) form++; } - while ((*form != '\0') && ((*buffer - start) < bufsize)) { + while ((*form != '\0') && ((size_t)(*buffer - start) < bufsize)) { switch(*form) { case 'u': case 'd': @@ -163,6 +163,7 @@ print_format(char **buffer, size_t bufsize, const char *format, void *var) break; case 'X': upper = true; + /* fallthrough */ case 'x': sizec[i] = '\0'; value = (unsigned long) var & convert[length_mod]; @@ -260,7 +261,7 @@ vsnprintf(char *buffer, size_t bufsize, const char *format, va_list arg) /* Leave one space for NULL character */ bufsize--; - while(*ptr != '\0' && (buffer - bstart) < bufsize) + while(*ptr != '\0' && (size_t)(buffer - bstart) < bufsize) { if(*ptr == '%') { char formstr[20]; diff --git a/lib/libc/string/memmove.c b/lib/libc/string/memmove.c index 3acf1a973bbe..9d0962847296 100644 --- a/lib/libc/string/memmove.c +++ b/lib/libc/string/memmove.c @@ -18,7 +18,7 @@ memmove(void *dest, const void *src, size_t n) { char *cdest; const char *csrc; - int i; + size_t i; /* Do the buffers overlap in a bad way? */ if (src < dest && src + n >= dest) { From patchwork Tue Feb 9 01:44:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQgv280Xz9sSC for ; Tue, 9 Feb 2021 12:45:15 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQgt3mhqzDvVt for ; Tue, 9 Feb 2021 12:45:14 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQgp584HzDsYt for ; Tue, 9 Feb 2021 12:45:09 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 40E54AE80212; Mon, 8 Feb 2021 20:45:05 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:47 +1100 Message-Id: <20210209014457.108301-3-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 02/12] elf: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. This changes the return value for the case when no ELF headers were found to avoid (ugly-ish) cast of -1 to unsigned. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- Changes: v2: * cast the return value to (int) * added missing (long) --- include/libelf.h | 6 +++--- lib/libelf/elf.c | 2 +- lib/libelf/elf32.c | 6 +++--- lib/libelf/elf64.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/libelf.h b/include/libelf.h index 48ff4d7beb68..29a4d049a096 100644 --- a/include/libelf.h +++ b/include/libelf.h @@ -96,9 +96,9 @@ void elf_relocate64(void *file_addr, signed long offset); int elf_forth_claim(void *addr, long size); -long elf_get_file_size(const void *buffer, const long buffer_size); -long elf_get_file_size32(const void *buffer, const long buffer_size); -long elf_get_file_size64(const void *buffer, const long buffer_size); +long elf_get_file_size(const void *buffer, const unsigned long buffer_size); +long elf_get_file_size32(const void *buffer, const unsigned long buffer_size); +long elf_get_file_size64(const void *buffer, const unsigned long buffer_size); #ifdef __BIG_ENDIAN__ #define elf64_to_cpu(x, ehdr) ((ehdr)->ei_data == ELFDATA2MSB ? (x) : bswap_64(x)) diff --git a/lib/libelf/elf.c b/lib/libelf/elf.c index d3684545aef7..f6a052ef3c9e 100644 --- a/lib/libelf/elf.c +++ b/lib/libelf/elf.c @@ -202,7 +202,7 @@ elf_get_base_addr(void *file_addr) * buffer larger than the size of the file * @return The size of the ELF image or < 0 for error */ -long elf_get_file_size(const void *buffer, const long buffer_size) +long elf_get_file_size(const void *buffer, const unsigned long buffer_size) { const struct ehdr *ehdr = (const struct ehdr *)buffer; diff --git a/lib/libelf/elf32.c b/lib/libelf/elf32.c index 64ea386a96da..45b0015b87ab 100644 --- a/lib/libelf/elf32.c +++ b/lib/libelf/elf32.c @@ -212,13 +212,13 @@ elf_byteswap_header32(void *file_addr) * file. * @return Return -1 on error, size of file otherwise. */ -long elf_get_file_size32(const void *buffer, const long buffer_size) +long elf_get_file_size32(const void *buffer, const unsigned long buffer_size) { const struct ehdr32 *ehdr = (const struct ehdr32 *) buffer; const uint8_t *buffer_end = buffer + buffer_size; const struct phdr32 *phdr; const struct shdr32 *shdr; - long elf_size = -1; + unsigned long elf_size = 0; uint16_t entsize; unsigned i; @@ -258,5 +258,5 @@ long elf_get_file_size32(const void *buffer, const long buffer_size) if (elf_size > buffer_size) return -1; - return elf_size; + return (long) elf_size; } diff --git a/lib/libelf/elf64.c b/lib/libelf/elf64.c index 0f302679f784..3bc40402fb8a 100644 --- a/lib/libelf/elf64.c +++ b/lib/libelf/elf64.c @@ -389,7 +389,7 @@ elf_apply_all_rela64(void *file_addr, signed long offset, struct shdr64 *shdrs, struct rela *relaentry; struct sym64 *symtabentry; uint32_t symbolidx; - int i; + unsigned i; /* If the referenced section has not been allocated, then it has * not been loaded and thus does not need to be relocated. */ @@ -481,13 +481,13 @@ uint32_t elf_get_eflags_64(void *file_addr) * file. * @return Return -1 on error, size of file otherwise. */ -long elf_get_file_size64(const void *buffer, const long buffer_size) +long elf_get_file_size64(const void *buffer, const unsigned long buffer_size) { const struct ehdr64 *ehdr = (const struct ehdr64 *) buffer; const uint8_t *buffer_end = buffer + buffer_size; const struct phdr64 *phdr; const struct shdr64 *shdr; - long elf_size = -1; + unsigned long elf_size = 0; uint16_t entsize; unsigned i; @@ -527,5 +527,5 @@ long elf_get_file_size64(const void *buffer, const long buffer_size) if (elf_size > buffer_size) return -1; - return elf_size; + return (long) elf_size; } From patchwork Tue Feb 9 01:44:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQh36rGLz9sSC for ; Tue, 9 Feb 2021 12:45:23 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQh33Ff5zDsYx for ; Tue, 9 Feb 2021 12:45:23 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQgq43M3zDsYs for ; Tue, 9 Feb 2021 12:45:11 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id EBAC3AE80224; Mon, 8 Feb 2021 20:45:08 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:48 +1100 Message-Id: <20210209014457.108301-4-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> MIME-Version: 1.0 Subject: [SLOF] [PATCH slof v2 03/12] usb: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes with one exception of -Wunused-parameter - this fixes it for debug macros only and leave the rest for the future as more functional change is needed. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- Changes: v2: * updated debug macros to fix -Wunused-parameter --- These are not fixed: ====== Building common libraries ====== [CC] usb-core.o [CC] usb-ohci.o [CC] usb-hid.o [CC] usb-xhci.o /home/aik/p/slof/lib/libusb/usb-core.c: In function ‘usb_set_address’: /home/aik/p/slof/lib/libusb/usb-core.c:244:58: warning: unused parameter ‘port’ [-Wunused-parameter] static int usb_set_address(struct usb_dev *dev, uint32_t port) ^~~~ /home/aik/p/slof/lib/libusb/usb-xhci.c: In function ‘xhci_send_enable_slot’: /home/aik/p/slof/lib/libusb/usb-xhci.c:353:67: warning: unused parameter ‘port’ [-Wunused-parameter] static void xhci_send_enable_slot(struct xhci_hcd *xhcd, uint32_t port) ^~~~ /home/aik/p/slof/lib/libusb/usb-ohci.c: In function ‘ohci_dump_regs’: /home/aik/p/slof/lib/libusb/usb-ohci.c:42:46: warning: unused parameter ‘regs’ [-Wunused-parameter] static void ohci_dump_regs(struct ohci_regs *regs) ^~~~ /home/aik/p/slof/lib/libusb/usb-core.c: In function ‘usb_handle_device’: /home/aik/p/slof/lib/libusb/usb-core.c:444:80: warning: unused parameter ‘cfg’ [-Wunused-parameter] static int usb_handle_device(struct usb_dev *dev, struct usb_dev_config_descr *cfg, ^~~ /home/aik/p/slof/lib/libusb/usb-xhci.c: In function ‘fill_setup_trb’: /home/aik/p/slof/lib/libusb/usb-xhci.c:1026:13: warning: unused parameter ‘size’ [-Wunused-parameter] uint32_t size) ^~~~ /home/aik/p/slof/lib/libusb/usb-xhci.c: In function ‘xhci_transfer_bulk’: /home/aik/p/slof/lib/libusb/usb-xhci.c:1217:60: warning: unused parameter ‘td’ [-Wunused-parameter] static int xhci_transfer_bulk(struct usb_pipe *pipe, void *td, void *td_phys, ^~ /home/aik/p/slof/lib/libusb/usb-xhci.c:1217:70: warning: unused parameter ‘td_phys’ [-Wunused-parameter] static int xhci_transfer_bulk(struct usb_pipe *pipe, void *td, void *td_phys, ^~~~~~~ /home/aik/p/slof/lib/libusb/usb-xhci.c: In function ‘xhci_get_pipe_intr’: /home/aik/p/slof/lib/libusb/usb-xhci.c:1364:22: warning: unused parameter ‘len’ [-Wunused-parameter] char *buf, size_t len) ^~~ --- lib/libusb/usb-core.c | 4 ++-- lib/libusb/usb-ehci.c | 3 ++- lib/libusb/usb-hid.c | 2 +- lib/libusb/usb-ohci.c | 12 +++++------- lib/libusb/usb-xhci.c | 17 +++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/libusb/usb-core.c b/lib/libusb/usb-core.c index 4c720ce2f85b..6ad8028d03a2 100644 --- a/lib/libusb/usb-core.c +++ b/lib/libusb/usb-core.c @@ -18,7 +18,7 @@ #ifdef DEBUG #define dprintf(_x ...) do { printf(_x); } while(0) #else -#define dprintf(_x ...) +#define dprintf(_x ...) do {} while (0) #endif #define __unused __attribute__((unused)) @@ -386,7 +386,7 @@ int usb_hid_exit(void *vdev) int usb_msc_init(void *vdev) { struct usb_dev *dev; - int i; + unsigned i; dev = (struct usb_dev *) vdev; dprintf("%s: enter %x\n", __func__, dev->class); diff --git a/lib/libusb/usb-ehci.c b/lib/libusb/usb-ehci.c index 60af9e101fab..4b1b0a8de5da 100644 --- a/lib/libusb/usb-ehci.c +++ b/lib/libusb/usb-ehci.c @@ -22,7 +22,8 @@ #ifdef EHCI_DEBUG #define dprintf(_x ...) do { printf(_x); } while(0) #else -#define dprintf(_x ...) +#define dprintf(_x ...) do {} while (0) + #endif #ifdef EHCI_DEBUG diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c index 1ea9ff235f58..ce87d2194163 100644 --- a/lib/libusb/usb-hid.c +++ b/lib/libusb/usb-hid.c @@ -390,7 +390,7 @@ uint32_t *kbd_buffer; int usb_hid_kbd_init(struct usb_dev *dev) { - int i; + unsigned i; uint8_t key[8]; usb_hid_set_protocol(dev, 0); diff --git a/lib/libusb/usb-ohci.c b/lib/libusb/usb-ohci.c index d06c754d184e..3f2ecf327444 100644 --- a/lib/libusb/usb-ohci.c +++ b/lib/libusb/usb-ohci.c @@ -21,7 +21,7 @@ #ifdef OHCI_DEBUG #define dprintf(_x ...) do { printf(_x); } while(0) #else -#define dprintf(_x ...) +#define dprintf(_x ...) do {} while (0) #endif #undef OHCI_DEBUG_PACKET @@ -29,7 +29,7 @@ #ifdef OHCI_DEBUG_PACKET #define dpprintf(_x ...) do { printf(_x); } while(0) #else -#define dpprintf(_x ...) +#define dpprintf(_x ...) do {} while (0) #endif @@ -199,10 +199,7 @@ static void ohci_hub_check_ports(struct ohci_hcd *ohcd) } if (port_status & RH_PS_PESC) { port_clear |= RH_PS_PESC; - if (port_status & RH_PS_PES) - dprintf("enabled\n"); - else - dprintf("disabled\n"); + dprintf((port_status & RH_PS_PES) ? "enabled\n" : "disabled\n"); } if (port_status & RH_PS_PSSC) { port_clear |= RH_PS_PESC; @@ -927,9 +924,10 @@ static struct usb_pipe *ohci_get_pipe(struct usb_dev *dev, struct usb_ep_descr * new->epno = ep->bEndpointAddress & 0xF; new->dir = ep->bEndpointAddress & 0x80; if (new->type == USB_EP_TYPE_INTR) - if (!ohci_get_pipe_intr(new, ohcd, buf, buflen)) + if (!ohci_get_pipe_intr(new, ohcd, buf, buflen)) { dprintf("usb-ohci: %s alloc_intr failed %p\n", __func__, new); + } if (new->type == USB_EP_TYPE_BULK) ohci_init_bulk_ed(dev, new); diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c index 3ce6c004fa42..cdf804287112 100644 --- a/lib/libusb/usb-xhci.c +++ b/lib/libusb/usb-xhci.c @@ -22,7 +22,7 @@ #ifdef XHCI_DEBUG #define dprintf(_x ...) do { printf("%s: ", __func__); printf(_x); } while (0) #else -#define dprintf(_x ...) +#define dprintf(_x ...) do {} while (0) #endif struct port_state ps_array_usb2[] = { @@ -42,9 +42,9 @@ struct port_state ps_array_usb3[] = { {1, 1, 1, 0, PORTSC_PLS_U0, "****** Enabled ******"}, }; +#ifdef XHCI_DEBUG static void dump_xhci_regs(struct xhci_hcd *xhcd) { -#ifdef XHCI_DEBUG struct xhci_cap_regs *cap; struct xhci_op_regs *op; struct xhci_run_regs *run; @@ -75,12 +75,10 @@ static void dump_xhci_regs(struct xhci_hcd *xhcd) dprintf(" - MFINDEX %08X\n", read_reg32(&run->mfindex)); dprintf("\n"); -#endif } static void print_port_status(struct xhci_port_regs *prs) { -#ifdef XHCI_DEBUG uint32_t portsc; uint32_t CCS, PED, PP, PLS, i, PR = 0; @@ -152,10 +150,13 @@ static void print_port_status(struct xhci_port_regs *prs) } } } -#endif - } +#else +#define dump_xhci_regs(r) do {} while (0) +#define print_port_status(prs) do {} while (0) +#endif + static inline bool xhci_is_hc_ready(uint32_t *usbsts) { return !(read_reg32(usbsts) & XHCI_USBSTS_CNR); @@ -1157,7 +1158,7 @@ static inline struct xhci_seg *xhci_pipe_get_seg(struct usb_pipe *pipe) static inline void *xhci_get_trb(struct xhci_seg *seg) { uint64_t val, enq; - int index; + unsigned index; struct xhci_link_trb *link; enq = val = seg->enq; @@ -1185,7 +1186,7 @@ static inline void *xhci_get_trb(struct xhci_seg *seg) static inline void *xhci_get_trb_deq(struct xhci_seg *seg) { uint64_t deq_next, deq; - int index; + unsigned index; deq = seg->deq; deq_next = deq + XHCI_TRB_SIZE; From patchwork Tue Feb 9 01:44:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQh94kw0z9sVX for ; Tue, 9 Feb 2021 12:45:29 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQh91cyczDvYN for ; Tue, 9 Feb 2021 12:45:29 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQgt312NzDsrd for ; Tue, 9 Feb 2021 12:45:14 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 9F977AE80110; Mon, 8 Feb 2021 20:45:11 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:49 +1100 Message-Id: <20210209014457.108301-5-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 04/12] veth: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- lib/libveth/veth.h | 2 +- lib/libveth/veth.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libveth/veth.h b/lib/libveth/veth.h index 23af0eab6211..6a1cb4cb5790 100644 --- a/lib/libveth/veth.h +++ b/lib/libveth/veth.h @@ -16,7 +16,7 @@ #include #include -extern net_driver_t *libveth_open(char *mac_addr, int mac_len, char *reg, int reg_len); +extern net_driver_t *libveth_open(char *mac_addr, unsigned mac_len, char *reg, unsigned reg_len); extern void libveth_close(net_driver_t *driver); extern int libveth_read(char *buf, int len, net_driver_t *driver); extern int libveth_write(char *buf, int len, net_driver_t *driver); diff --git a/lib/libveth/veth.c b/lib/libveth/veth.c index 748730854035..a8e19ba41764 100644 --- a/lib/libveth/veth.c +++ b/lib/libveth/veth.c @@ -164,7 +164,7 @@ static int veth_term(net_driver_t *driver) return 0; } -static int veth_receive(char *f_buffer_pc, int f_len_i, net_driver_t *driver) +static int veth_receive(char *f_buffer_pc, unsigned f_len_i, net_driver_t *driver) { int packet = 0; @@ -223,10 +223,14 @@ static int veth_xmit(char *f_buffer_pc, int f_len_i, net_driver_t *driver) return f_len_i; } -net_driver_t *libveth_open(char *mac_addr, int mac_len, char *reg, int reg_len) +net_driver_t *libveth_open(char *mac_addr, unsigned mac_len, char *reg, unsigned reg_len) { net_driver_t *driver; + if (reg_len != sizeof(uint32_t)) { + printf("vio reg must 1 cell long\n"); + return NULL; + } driver = SLOF_alloc_mem(sizeof(*driver)); if (!driver) { printf("Unable to allocate veth driver\n"); From patchwork Tue Feb 9 01:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQhM0hg8z9sVX for ; Tue, 9 Feb 2021 12:45:39 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhK732bzDsZ5 for ; Tue, 9 Feb 2021 12:45:37 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQgx1L13zDsbH for ; Tue, 9 Feb 2021 12:45:17 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 607B3AE80229; Mon, 8 Feb 2021 20:45:13 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:50 +1100 Message-Id: <20210209014457.108301-6-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 05/12] virtio: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Reviewed-by: Thomas Huth Signed-off-by: Alexey Kardashevskiy --- lib/libvirtio/p9.c | 8 ++++---- lib/libvirtio/virtio.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libvirtio/p9.c b/lib/libvirtio/p9.c index 0e595303196a..e9ba22886c06 100644 --- a/lib/libvirtio/p9.c +++ b/lib/libvirtio/p9.c @@ -142,7 +142,7 @@ void reset_buffers(void) int p9_transaction(p9_connection_t *connection) { int rc; - int tx_size = GET_SIZE; + uint32_t tx_size = GET_SIZE; uint32_t rx_size = connection->message_size; if (transact == NULL) { @@ -248,7 +248,7 @@ int p9_version(p9_connection_t *connection) int p9_attach(p9_connection_t *connection) { int rc; - int length = 19 + strlen(connection->uname) + strlen(connection->aname); + unsigned length = 19 + strlen(connection->uname) + strlen(connection->aname); if (length > connection->message_size) { return P9_MSG_TOO_LONG; @@ -372,8 +372,8 @@ int p9_walk(p9_connection_t *connection, uint32_t fid, uint32_t new_fid, s_tok = e_tok; continue; } - int tx_size = (e_tok - s_tok + 2 + GET_SIZE); - int rx_size = ((element_count + 1) * MSG_QID_SIZE + unsigned tx_size = (e_tok - s_tok + 2 + GET_SIZE); + unsigned rx_size = ((element_count + 1) * MSG_QID_SIZE + MSG_WALK_RX_HDR_SIZE); if ((tx_size > connection->message_size) || (rx_size > connection->message_size)) { diff --git a/lib/libvirtio/virtio.c b/lib/libvirtio/virtio.c index 69ac4394e104..9dfc93cb2876 100644 --- a/lib/libvirtio/virtio.c +++ b/lib/libvirtio/virtio.c @@ -436,7 +436,7 @@ struct vqs *virtio_queue_init_vq(struct virtio_device *dev, unsigned int id) void virtio_queue_term_vq(struct virtio_device *dev, struct vqs *vq, unsigned int id) { if (vq->desc_gpas) { - int i; + unsigned i; for (i = 0; i < vq->size; ++i) virtio_free_desc(vq, i, dev->features); From patchwork Tue Feb 9 01:44:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQjn2ynTz9sSC for ; Tue, 9 Feb 2021 12:46:53 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQjn2JYNzDvYv for ; Tue, 9 Feb 2021 12:46:53 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhZ41mQzDvYQ for ; Tue, 9 Feb 2021 12:45:49 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 1F120AE80110; Mon, 8 Feb 2021 20:45:16 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:51 +1100 Message-Id: <20210209014457.108301-7-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 06/12] e1000: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy --- lib/libe1k/e1k.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libe1k/e1k.c b/lib/libe1k/e1k.c index 4dd7d2eb97c2..3bbc75fba199 100644 --- a/lib/libe1k/e1k.c +++ b/lib/libe1k/e1k.c @@ -163,7 +163,7 @@ static const e1k_dev_t e1k_dev[] = { { 0x1016, E1K_82540, "82540EP Mobile" }, { 0x1017, E1K_82540, "82540EP Desktop" }, { 0x100E, E1K_82540, "82540EM Desktop" }, - { 0 , 0 } + { 0 } }; /* @@ -182,8 +182,8 @@ check_driver(uint16_t vendor_id, uint16_t device_id); static int e1k_init(net_driver_t *driver); static int e1k_term(void); -static int e1k_xmit(char *f_buffer_pc, int f_len_i); -static int e1k_receive(char *f_buffer_pc, int f_len_i); +static int e1k_xmit(char *f_buffer_pc, unsigned f_len_i); +static int e1k_receive(char *f_buffer_pc, unsigned f_len_i); /** * Translate virtual to "physical" address, ie. an address @@ -549,11 +549,11 @@ e1k_mac_init(uint8_t *f_mac_pu08) * e1k_receive */ static int -e1k_receive(char *f_buffer_pc, int f_len_i) +e1k_receive(char *f_buffer_pc, unsigned f_len_i) { uint32_t l_rdh_u32 = e1k_rd32(RDH); // this includes needed dummy read e1k_rx_desc_st *rx; - int l_ret_i; + unsigned l_ret_i; #ifdef E1K_DEBUG #ifdef E1K_SHOW_RCV_DATA @@ -589,11 +589,11 @@ e1k_receive(char *f_buffer_pc, int f_len_i) * copy the data */ memcpy((uint8_t *) f_buffer_pc, dma2virt(bswap_64(rx->m_buffer_u64)), - (size_t) l_ret_i); + (size_t) MIN(l_ret_i, f_len_i)); #ifdef E1K_DEBUG #if defined(E1K_SHOW_RCV) || defined(E1K_SHOW_RCV_DATA) - printf("e1k: %d bytes received\n", l_ret_i); + printf("e1k: %d bytes received (max %d)\n", l_ret_i, f_len_i); #endif #ifdef E1K_SHOW_RCV_DATA @@ -631,7 +631,7 @@ e1k_receive(char *f_buffer_pc, int f_len_i) } static int -e1k_xmit(char *f_buffer_pc, int f_len_i) +e1k_xmit(char *f_buffer_pc, unsigned f_len_i) { uint32_t l_tdh_u32 = e1k_rd32(TDH); uint32_t l_tdt_u32 = e1k_rd32(TDT); From patchwork Tue Feb 9 01:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQhX0G2cz9sVb for ; Tue, 9 Feb 2021 12:45:48 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhV64dFzDvYx for ; Tue, 9 Feb 2021 12:45:46 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQh23V53zDvYN for ; Tue, 9 Feb 2021 12:45:22 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id D06F0AE80278; Mon, 8 Feb 2021 20:45:19 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:52 +1100 Message-Id: <20210209014457.108301-8-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 07/12] libnet: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. This also fixes unused parameters warning by passing meaningful value and doing sanity checks. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * updated commit log about using AF_INET/etc * replaced cast to int with size_t in pxelinux_load_cfg * added (alen == 0) in ping() --- lib/libnet/netapps.h | 4 ++-- lib/libnet/netload.c | 4 ++-- lib/libnet/ping.c | 6 +++--- lib/libnet/pxelinux.c | 5 +++-- slof/ppc64.c | 12 +++++++++--- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/libnet/netapps.h b/lib/libnet/netapps.h index 6e00466de5a9..722ca7ff7ab4 100644 --- a/lib/libnet/netapps.h +++ b/lib/libnet/netapps.h @@ -18,8 +18,8 @@ struct filename_ip; -extern int netload(char *buffer, int len, char *args_fs, int alen); -extern int ping(char *args_fs, int alen); +extern int netload(char *buffer, int len, char *args_fs, unsigned alen); +extern int ping(char *args_fs, unsigned alen); extern int dhcp(char *ret_buffer, struct filename_ip *fn_ip, unsigned int retries, int flags); diff --git a/lib/libnet/netload.c b/lib/libnet/netload.c index 2dc00f00097d..ae169f3e015d 100644 --- a/lib/libnet/netload.c +++ b/lib/libnet/netload.c @@ -528,7 +528,7 @@ static void encode_response(char *pkt_buffer, size_t size, int ip_init) } } -int netload(char *buffer, int len, char *args_fs, int alen) +int netload(char *buffer, int len, char *args_fs, unsigned alen) { int rc, filename_len; filename_ip_t fn_ip; @@ -566,7 +566,7 @@ int netload(char *buffer, int len, char *args_fs, int alen) set_timer(TICKS_SEC); while (get_timer() > 0); } - fd_device = socket(0, 0, 0, (char*) own_mac); + fd_device = socket(AF_INET, SOCK_DGRAM, 0, (char*) own_mac); if(fd_device != -2) break; if(getchar() == 27) { diff --git a/lib/libnet/ping.c b/lib/libnet/ping.c index 51db061ecaff..6ff6f9f91681 100644 --- a/lib/libnet/ping.c +++ b/lib/libnet/ping.c @@ -106,7 +106,7 @@ parse_args(const char *args, struct ping_args *ping_args) return 0; } -int ping(char *args_fs, int alen) +int ping(char *args_fs, unsigned alen) { short arp_failed = 0; filename_ip_t fn_ip; @@ -119,7 +119,7 @@ int ping(char *args_fs, int alen) memset(&ping_args, 0, sizeof(struct ping_args)); - if (alen <= 0 || alen >= sizeof(args) - 1) { + if (alen == 0 || alen >= sizeof(args) - 1) { usage(); return -1; } @@ -137,7 +137,7 @@ int ping(char *args_fs, int alen) /* Get mac_addr from device */ printf("\n Reading MAC address from device: "); - fd_device = socket(0, 0, 0, (char *) own_mac); + fd_device = socket(AF_INET, SOCK_DGRAM, 0, (char *) own_mac); if (fd_device == -1) { printf("\nE3000: Could not read MAC address\n"); return -100; diff --git a/lib/libnet/pxelinux.c b/lib/libnet/pxelinux.c index c4ac5d5a078a..b32f23351cf0 100644 --- a/lib/libnet/pxelinux.c +++ b/lib/libnet/pxelinux.c @@ -55,7 +55,8 @@ static int pxelinux_tftp_load(filename_ip_t *fnip, void *buffer, int len, static int pxelinux_load_cfg(filename_ip_t *fn_ip, uint8_t *mac, const char *uuid, int retries, char *cfgbuf, int cfgbufsize) { - int rc, idx; + int rc; + unsigned idx; char *baseptr; /* Did we get a usable base directory via DHCP? */ @@ -77,7 +78,7 @@ static int pxelinux_load_cfg(filename_ip_t *fn_ip, uint8_t *mac, const char *uui ++baseptr; /* Check that we've got enough space to store "pxelinux.cfg/" * and the UUID (which is the longest file name) there */ - if (baseptr - fn_ip->filename > sizeof(fn_ip->filename) - 50) { + if ((size_t)(baseptr - fn_ip->filename) > (sizeof(fn_ip->filename) - 50)) { puts("Error: The bootfile string is too long for " "deriving the pxelinux.cfg file name from it."); return -1; diff --git a/slof/ppc64.c b/slof/ppc64.c index 83a8e82cfb42..ca6cafffc35d 100644 --- a/slof/ppc64.c +++ b/slof/ppc64.c @@ -144,6 +144,12 @@ int socket(int domain, int type, int proto, char *mac_addr) int prop_len; int fd; + if (!(domain == AF_INET || domain == AF_INET6)) + return -1; + + if (type != SOCK_DGRAM || proto != 0) + return -1; + /* search free file descriptor (and skip stdio handlers) */ for (fd = 3; fd < FILEIO_MAX; ++fd) { if (fd_array[fd].type == FILEIO_TYPE_EMPTY) { @@ -217,7 +223,7 @@ int close(int fd) */ int recv(int fd, void *buf, int len, int flags) { - if (!is_valid_fd(fd)) + if (!is_valid_fd(fd) || flags) return -1; forth_push((unsigned long)buf); @@ -237,7 +243,7 @@ int recv(int fd, void *buf, int len, int flags) */ int send(int fd, const void *buf, int len, int flags) { - if (!is_valid_fd(fd)) + if (!is_valid_fd(fd) || flags) return -1; forth_push((unsigned long)buf); @@ -258,7 +264,7 @@ int send(int fd, const void *buf, int len, int flags) ssize_t read(int fd, void *buf, size_t len) { char *ptr = (char *)buf; - int cnt = 0; + unsigned cnt = 0; char code; if (fd == 0 || fd == 2) { From patchwork Tue Feb 9 01:44:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQhf5KX1z9sCq for ; Tue, 9 Feb 2021 12:45:54 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhf4qjVzDvYR for ; Tue, 9 Feb 2021 12:45:54 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQh50HplzDvYf for ; Tue, 9 Feb 2021 12:45:25 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 85151AE80279; Mon, 8 Feb 2021 20:45:22 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:53 +1100 Message-Id: <20210209014457.108301-9-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 08/12] libhv: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Reviewed-by: Thomas Huth Signed-off-by: Alexey Kardashevskiy --- include/ppcp7/cache.h | 2 +- lib/libhvcall/rfill.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ppcp7/cache.h b/include/ppcp7/cache.h index 3c02bb10de63..611b6a33599e 100644 --- a/include/ppcp7/cache.h +++ b/include/ppcp7/cache.h @@ -124,7 +124,7 @@ static inline void ci_rmove(void *dst, void *src, unsigned long esize, #define FAST_MRMOVE(s, d, size) _FASTRMOVE(s, d, size) -extern void fast_rfill(char *dst, long size, char pat); +extern void fast_rfill(char *dst, unsigned long size, char pat); #define FAST_RFILL(dst, size, pat) fast_rfill(dst, size, pat) static inline uint16_t bswap16_load(uint64_t addr) diff --git a/lib/libhvcall/rfill.c b/lib/libhvcall/rfill.c index 5407cd2a60e7..377fb892ba60 100644 --- a/lib/libhvcall/rfill.c +++ b/lib/libhvcall/rfill.c @@ -23,7 +23,7 @@ typedef unsigned long type_u; * local buffer - and that caused stack size problems in engine() when * we used it directly in the FAST_RFILL macro. */ -void fast_rfill(char *dst, long size, char pat) +void fast_rfill(char *dst, unsigned long size, char pat) { type_u buf[64]; From patchwork Tue Feb 9 01:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQhl0f4zz9sSC for ; Tue, 9 Feb 2021 12:45:59 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhk6FdJzDvZB for ; Tue, 9 Feb 2021 12:45:58 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQh80tXyzDsbH for ; Tue, 9 Feb 2021 12:45:28 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 430DFAE8027A; Mon, 8 Feb 2021 20:45:24 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:54 +1100 Message-Id: <20210209014457.108301-10-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 09/12] libnvram: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy --- lib/libnvram/nvram.h | 10 +++++----- lib/libnvram/envvar.c | 13 ++++++------- lib/libnvram/nvram.c | 13 ++++++------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/libnvram/nvram.h b/lib/libnvram/nvram.h index 73fe44424400..c8aad3151d96 100644 --- a/lib/libnvram/nvram.h +++ b/lib/libnvram/nvram.h @@ -47,7 +47,7 @@ nvram_access_proto(uint64_t, qword) /* nvram.c */ -char *get_nvram_buffer(int len); +char *get_nvram_buffer(unsigned len); void free_nvram_buffer(char *buffer); int nvramlog_printf(const char* fmt, ...); partition_t get_partition(unsigned int type, char *name); @@ -67,9 +67,9 @@ void nvram_init(uint32_t store_token, uint32_t fetch_token, unsigned int get_nvram_size(void); /* envvar.c */ -char *nvram_get_env(partition_t part, char *envvar, int evlen); -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen); -int nvram_del_env(partition_t part, char *envvar, int evlen); -int nvram_set_env(partition_t part, char *envvar, int evlen, char *val, int vlen); +char *nvram_get_env(partition_t part, char *envvar, unsigned evlen); +int nvram_add_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen); +int nvram_del_env(partition_t part, char *envvar, unsigned evlen); +int nvram_set_env(partition_t part, char *envvar, unsigned evlen, char *val, unsigned vlen); #endif diff --git a/lib/libnvram/envvar.c b/lib/libnvram/envvar.c index ee943fce5127..d413e9750d77 100644 --- a/lib/libnvram/envvar.c +++ b/lib/libnvram/envvar.c @@ -46,7 +46,7 @@ static int get_past_env_pos(partition_t part, char *envvar, int evlen) * @param evlen string length of the envvar parameter * @return pointer to temporary string containing the value of envvar */ -char *nvram_get_env(partition_t part, char *envvar, int evlen) +char *nvram_get_env(partition_t part, char *envvar, unsigned evlen) { static char temp[256+1]; int len, offset; @@ -100,10 +100,9 @@ static int find_last_envvar(partition_t part) return -1; } -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_add_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { - int freespace, last, len, offset; - unsigned int i; + unsigned i, freespace, last, len, offset; /* Find offset where we can write */ last = find_last_envvar(part); @@ -132,7 +131,7 @@ int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int va return 0; } -int nvram_del_env(partition_t part, char *envvar, int evlen) +int nvram_del_env(partition_t part, char *envvar, unsigned evlen) { int last, current, pos, i; char *buffer; @@ -168,10 +167,10 @@ int nvram_del_env(partition_t part, char *envvar, int evlen) return 0; } -int nvram_set_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_set_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { char *oldvalue, *buffer; - int last, current, buffersize, i; + unsigned last, current, buffersize, i; DEBUG("nvram_set_env %lx[%lx]: %p=>%p\n", part.addr, part.len, envvar, value); diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c index 99deb2a8f7e4..6d145d79e86c 100644 --- a/lib/libnvram/nvram.c +++ b/lib/libnvram/nvram.c @@ -163,7 +163,7 @@ nvram_access(uint64_t, 64, qword) * @return pointer to temporary buffer */ -char *get_nvram_buffer(int len) +char *get_nvram_buffer(unsigned len) { if(len>NVRAM_LENGTH) return NULL; @@ -271,7 +271,7 @@ static uint8_t calc_partition_header_checksum(int offset) static int calc_used_nvram_space(void) { - int walk, len; + unsigned walk, len; for (walk=0; walk X-Patchwork-Id: 1438079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQjt2fYCz9sSC for ; Tue, 9 Feb 2021 12:46:58 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQjs38D1zDvYg for ; Tue, 9 Feb 2021 12:46:57 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhm62YQzDvZS for ; Tue, 9 Feb 2021 12:46:00 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 36F73AE8027B; Mon, 8 Feb 2021 20:45:27 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:55 +1100 Message-Id: <20210209014457.108301-11-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 10/12] libtpm: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Note this adds MIN() in tpm_gpt_set_lba1() so it may potentially fail which is unlikely as the length comes from disk-label's block-size which is used in other places. Signed-off-by: Alexey Kardashevskiy --- lib/libtpm/tcgbios.c | 10 +++++----- lib/libtpm/tpm_drivers.c | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c index 8e808115bc59..f9e46027b599 100644 --- a/lib/libtpm/tcgbios.c +++ b/lib/libtpm/tcgbios.c @@ -356,7 +356,7 @@ tpm_simple_cmd(uint8_t locty, uint32_t ordinal, int param_size, uint16_t param, memset(obuffer, 0, sizeof(obuffer)); ret = spapr_transmit(locty, &req.trqh, obuffer, &obuffer_len, to_t); - ret = ret ? -1 : be32_to_cpu(trsh->errcode); + ret = ret ? -1 : (int) be32_to_cpu(trsh->errcode); dprintf("Return from tpm_simple_cmd(%x, %x) = %x\n", ordinal, param, ret); @@ -382,7 +382,7 @@ tpm20_getcapability(uint32_t capability, uint32_t property, uint32_t count, TPM_DURATION_TYPE_SHORT); ret = (ret || rsize < be32_to_cpu(rsp->totlen)) ? -1 - : be32_to_cpu(rsp->errcode); + : (int) be32_to_cpu(rsp->errcode); dprintf("TCGBIOS: Return value from sending TPM2_CC_GetCapability = 0x%08x\n", ret); @@ -664,7 +664,7 @@ static int tpm20_write_EfiSpecIdEventStruct(void) }; struct tpms_pcr_selection *sel; void *nsel, *end; - int event_size; + unsigned event_size; uint8_t *vendorInfoSize; struct tpm_log_entry le = { .hdr.eventtype = cpu_to_log32(EV_NO_ACTION), @@ -1024,7 +1024,7 @@ void tpm_gpt_set_lba1(const uint8_t *addr, uint32_t length) return; memcpy(&uefi_gpt_data->EfiPartitionHeader, - addr, sizeof(uefi_gpt_data->EfiPartitionHeader)); + addr, MIN(sizeof(uefi_gpt_data->EfiPartitionHeader), length)); uefi_gpt_data->NumberOfPartitions = 0; } @@ -1252,7 +1252,7 @@ tpm20_set_pcrbanks(uint32_t active_banks) ret = spapr_transmit(0, &trpa.hdr, &rsp, &resp_length, TPM_DURATION_TYPE_SHORT); - ret = ret ? -1 : be32_to_cpu(rsp.errcode); + ret = ret ? -1 : (int) be32_to_cpu(rsp.errcode); return ret; } diff --git a/lib/libtpm/tpm_drivers.c b/lib/libtpm/tpm_drivers.c index 0e13561d0fa0..85cb3098712d 100644 --- a/lib/libtpm/tpm_drivers.c +++ b/lib/libtpm/tpm_drivers.c @@ -357,8 +357,7 @@ static bool spapr_vtpm_senddata(const uint8_t *const data, uint32_t len) static bool spapr_vtpm_waitresponseready(enum tpm_duration_type to_t) { - uint32_t timeout = tpm2_durations[to_t]; - int i; + uint32_t i, timeout = tpm2_durations[to_t]; if (vtpm_drv_error_get() != VTPM_DRV_ERROR_NO_FAILURE) { printf("%s: VTPM CRQ: In failure mode\n", __func__); @@ -426,6 +425,8 @@ int spapr_transmit(uint8_t locty, struct tpm_req_header *req, void *respbuffer, uint32_t *respbufferlen, enum tpm_duration_type to_t) { + if (locty) + return -1; if (!spapr_vtpm_senddata((uint8_t *)req, be32_to_cpu(req->totlen)) || !spapr_vtpm_waitresponseready(to_t) || !spapr_vtpm_readresponse(respbuffer, respbufferlen) || From patchwork Tue Feb 9 01:44:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQhr23WRz9sSC for ; Tue, 9 Feb 2021 12:46:04 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhr01DhzDvZ4 for ; Tue, 9 Feb 2021 12:46:04 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhF4SJbzDsZ5 for ; Tue, 9 Feb 2021 12:45:33 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id E20C9AE8027C; Mon, 8 Feb 2021 20:45:30 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:56 +1100 Message-Id: <20210209014457.108301-12-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 11/12] slof/prim: Compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- slof/prim.code | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slof/prim.code b/slof/prim.code index bb9e036a9933..b9db1519cbcb 100644 --- a/slof/prim.code +++ b/slof/prim.code @@ -469,18 +469,21 @@ code_FILL: #endif while ((size-=sizeof(type_u)) >= 0) *up++ = fill_v; + break; } case sizeof(type_l): { type_l *lp = (type_l *)d; while ((size-=sizeof(type_l)) >= 0) *lp++ = (type_l)fill_v; + break; } case sizeof(type_w): { type_w *wp = (type_w *)d; while ((size-=sizeof(type_w)) >= 0) *wp++ = (type_w)fill_v; + break; } default: while (size-- > 0) From patchwork Tue Feb 9 01:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1438077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DZQjc56K8z9sCq for ; Tue, 9 Feb 2021 12:46:44 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQjb1dcgzDsZ5 for ; Tue, 9 Feb 2021 12:46:43 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 4DZQhK25mYzDvYg for ; Tue, 9 Feb 2021 12:45:37 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id D5076AE8027D; Mon, 8 Feb 2021 20:45:33 -0500 (EST) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Tue, 9 Feb 2021 12:44:57 +1100 Message-Id: <20210209014457.108301-13-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210209014457.108301-1-aik@ozlabs.ru> References: <20210209014457.108301-1-aik@ozlabs.ru> Subject: [SLOF] [PATCH slof v2 12/12] Makefile: Actually compile with -Wextra X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" -Wextra enables a bunch of rather useful checks which this fixes. The only exception is -Wno-unused-parameter, one thing at the time. Signed-off-by: Alexey Kardashevskiy --- make.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make.rules b/make.rules index 3dfbb5b136c2..885eea3f48b0 100644 --- a/make.rules +++ b/make.rules @@ -76,7 +76,7 @@ AR ?= $(CROSS)ar RANLIB ?= $(CROSS)ranlib CPP ?= $(CROSS)cpp -WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wformat-security +WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter CFLAGS ?= -g -O2 -fno-builtin -ffreestanding -nostdinc -msoft-float \ -fno-strict-aliasing -mno-altivec -mabi=no-altivec \ -fno-stack-protector -fno-asynchronous-unwind-tables $(WARNFLAGS)