All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH phosphor-host-ipmid 0/7] Warning fixes
@ 2015-11-25  7:10 OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 1/7] Remove unused variables and labels OpenBMC Patches
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

One real bug, a bunch of unused variables and a missing header.

https://github.com/openbmc/phosphor-host-ipmid/pull/45

Joel Stanley (7):
  Remove unused variables and labels
  ipmid-api: wrap in extern "C"
  host-services: Add ipmid-api header
  sensorhandler: remove unused variable
  another unused var
  apphandler: Remove out of bounds array access
  Makefile: build with -Wall

 Makefile           |  3 +++
 apphandler.C       |  3 +--
 host-services.c    |  4 +++-
 ipmid-api.h        | 15 +++++++++++----
 ipmid.C            |  6 ++----
 sensorhandler.C    |  3 ---
 storageaddsel.C    |  4 +---
 transporthandler.C |  2 --
 8 files changed, 21 insertions(+), 19 deletions(-)

-- 
2.6.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 1/7] Remove unused variables and labels
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 2/7] ipmid-api: wrap in extern "C" OpenBMC Patches
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 ipmid.C         | 6 ++----
 storageaddsel.C | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/ipmid.C b/ipmid.C
index 440705c..f1f938c 100644
--- a/ipmid.C
+++ b/ipmid.C
@@ -233,7 +233,6 @@ static int send_ipmi_message(sd_bus_message *req, unsigned char seq, unsigned ch
 static int handle_ipmi_command(sd_bus_message *m, void *user_data, sd_bus_error
                          *ret_error) {
     int r = 0;
-    const char *msg = NULL;
     unsigned char sequence, netfn, lun, cmd;
     const void *request;
     size_t sz;
@@ -375,7 +374,6 @@ int main(int argc, char *argv[])
 {
     sd_bus_slot *slot = NULL;
     int r;
-    char *mode = NULL;
     unsigned long tvalue;
     int c;
 
@@ -458,7 +456,7 @@ finish:
 // step for mapping IPMI
 int find_interface_property_fru_type(dbus_interface_t *interface, const char *property_name, char *property_value) {
 
-    char  *str1, *str2, *str3;
+    char  *str1;
     sd_bus_error error = SD_BUS_ERROR_NULL;
     sd_bus_message *reply = NULL, *m=NULL;
 
@@ -604,7 +602,7 @@ int set_sensor_dbus_state_v(uint8_t number, const char *method, char *value) {
     dbus_interface_t a;
     int r;
     sd_bus_error error = SD_BUS_ERROR_NULL;
-    sd_bus_message *reply = NULL, *m=NULL;
+    sd_bus_message *m=NULL;
 
     fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of %s\n",
         number, method, value);
diff --git a/storageaddsel.C b/storageaddsel.C
index 64b0e6a..345dfd5 100644
--- a/storageaddsel.C
+++ b/storageaddsel.C
@@ -136,7 +136,6 @@ int create_esel_description(const uint8_t *buffer, const char *sev, char **messa
 
 
 	ipmi_add_sel_request_t *p;
-	int r;
 	char *m;
 
 	p =  ( ipmi_add_sel_request_t *) buffer;
@@ -197,7 +196,6 @@ int send_esel_to_dbus(const char *desc, const char *sev, const char *details, ui
         r = *pty;
     }
 
-finish:
     sd_bus_error_free(&error);
     sd_bus_message_unref(m);
     sd_bus_message_unref(reply);
@@ -207,7 +205,7 @@ finish:
 
 
 void send_esel(uint16_t recordid) {
-	char *desc, *assoc, *ascii;
+	char *desc, *assoc;
 	const char *sev;
 	uint8_t *buffer = NULL;
 	char *path, *pathsent;
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 2/7] ipmid-api: wrap in extern "C"
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 1/7] Remove unused variables and labels OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 3/7] host-services: Add ipmid-api header OpenBMC Patches
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Wrap the entire header in an ifdef'd extern "C" so it can be used from C
files.  This fixes compilation for c files that need the header.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 ipmid-api.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ipmid-api.h b/ipmid-api.h
index 2d58961..4f4b9de 100644
--- a/ipmid-api.h
+++ b/ipmid-api.h
@@ -3,6 +3,10 @@
 #include <stdlib.h>
 #include <systemd/sd-bus.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // length of Completion Code and its ALWAYS _1_
 #define IPMI_CC_LEN 1
 
@@ -51,9 +55,7 @@ typedef ipmi_ret_t (*ipmid_callback_t)(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
 // This is the constructor function that is called into by each plugin handlers.
 // When ipmi sets up the callback handlers, a call is made to this with
 // information of netfn, cmd, callback handler pointer and context data.
-// Making this a extern "C" so that plugin libraries written in C can also use
-// it.
-extern "C" void ipmi_register_callback(ipmi_netfn_t, ipmi_cmd_t,
+void ipmi_register_callback(ipmi_netfn_t, ipmi_cmd_t,
                                        ipmi_context_t, ipmid_callback_t);
 
 // These are the command network functions, the response
@@ -94,5 +96,10 @@ enum ipmi_return_codes
     IPMI_CC_UNSPECIFIED_ERROR = 0xFF,
 };
 
-extern "C" sd_bus *ipmid_get_sd_bus_connection(void);
+sd_bus *ipmid_get_sd_bus_connection(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 3/7] host-services: Add ipmid-api header
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 1/7] Remove unused variables and labels OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 2/7] ipmid-api: wrap in extern "C" OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 4/7] sensorhandler: remove unused variable OpenBMC Patches
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Needed for a prototype for ipmid_get_sd_bus_connection.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 host-services.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/host-services.c b/host-services.c
index 89f0b6c..ab9cfcc 100644
--- a/host-services.c
+++ b/host-services.c
@@ -3,6 +3,8 @@
 #include <errno.h>
 #include <systemd/sd-bus.h>
 
+#include "ipmid-api.h"
+
 // OpenBMC Host IPMI dbus framework
 const char  *bus_name      =  "org.openbmc.HostIpmi";
 const char  *object_name   =  "/org/openbmc/HostIpmi/1";
@@ -38,7 +40,7 @@ static int soft_power_off(sd_bus_message *m, void *userdata, sd_bus_error *ret_e
     sd_bus_error bus_error = SD_BUS_ERROR_NULL;
 
 	// Gets a hook onto either a SYSTEM or SESSION bus
-	sd_bus *bus = (sd_bus *)ipmid_get_sd_bus_connection();
+	sd_bus *bus = ipmid_get_sd_bus_connection();
 
 	rc = sd_bus_call_method(bus,        // On the System Bus
 							bus_name,        // Service to contact
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 4/7] sensorhandler: remove unused variable
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
                   ` (2 preceding siblings ...)
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 3/7] host-services: Add ipmid-api header OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 5/7] another unused var OpenBMC Patches
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 sensorhandler.C | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sensorhandler.C b/sensorhandler.C
index cd57dd4..dd83152 100644
--- a/sensorhandler.C
+++ b/sensorhandler.C
@@ -145,9 +145,6 @@ ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 {
     sensor_data_t *reqptr = (sensor_data_t*)request;
     ipmi_ret_t rc = IPMI_CC_OK;
-    unsigned short rlen;
-
-    rlen = (unsigned short) *data_len;
 
     printf("IPMI SET_SENSOR [0x%02x]\n",reqptr->sennum);
 
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 5/7] another unused var
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
                   ` (3 preceding siblings ...)
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 4/7] sensorhandler: remove unused variable OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 6/7] apphandler: Remove out of bounds array access OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 7/7] Makefile: build with -Wall OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 transporthandler.C | 2 --
 1 file changed, 2 deletions(-)

diff --git a/transporthandler.C b/transporthandler.C
index ca8522d..0f7a730 100644
--- a/transporthandler.C
+++ b/transporthandler.C
@@ -31,8 +31,6 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 {
     ipmi_ret_t rc = IPMI_CC_OK;
     *data_len = 0;
-
-    int i = 0;
     char syscmd[128];
 
     printf("IPMI SET_LAN\n");
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 6/7] apphandler: Remove out of bounds array access
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
                   ` (4 preceding siblings ...)
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 5/7] another unused var OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 7/7] Makefile: build with -Wall OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

apphandler.C:188:24: warning: array subscript is above array bounds [-Warray-bounds]
             tmp_array[3] = '\0';
                        ^

Initalise tmp_array to zero, and avoid this bad access.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 apphandler.C | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/apphandler.C b/apphandler.C
index d3df330..2c9ce6b 100644
--- a/apphandler.C
+++ b/apphandler.C
@@ -184,8 +184,7 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
 
         for(i = 0; i < tmp_size; i++)
         {
-            char tmp_array[3]; // Holder of the 2 chars that will become a byte
-            tmp_array[3] = '\0';
+            char tmp_array[3] = {0}; // Holder of the 2 chars that will become a byte
             strncpy(tmp_array, id_octet, 2); // 2 chars at a time
 
             int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH phosphor-host-ipmid 7/7] Makefile: build with -Wall
  2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
                   ` (5 preceding siblings ...)
  2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 6/7] apphandler: Remove out of bounds array access OpenBMC Patches
@ 2015-11-25  7:10 ` OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-25  7:10 UTC (permalink / raw
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 1851c9f..57ad6fe 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,9 @@ LIB_APP     = libapphandler.so
 INSTALLED_LIBS += $(LIB_APP)
 INSTALLED_HEADERS = ipmid-api.h
 
+CXXFLAGS += -Wall -Wno-unused-result
+CFLAGS += -Wall -Wno-unused-result
+
 INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
 LIB_FLAG += $(shell pkg-config  --libs libsystemd) -rdynamic
 IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-25  7:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25  7:10 [PATCH phosphor-host-ipmid 0/7] Warning fixes OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 1/7] Remove unused variables and labels OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 2/7] ipmid-api: wrap in extern "C" OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 3/7] host-services: Add ipmid-api header OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 4/7] sensorhandler: remove unused variable OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 5/7] another unused var OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 6/7] apphandler: Remove out of bounds array access OpenBMC Patches
2015-11-25  7:10 ` [PATCH phosphor-host-ipmid 7/7] Makefile: build with -Wall OpenBMC Patches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.