10721 ib: NULL pointer errors

Review Request #1687 - Created April 10, 2019 and updated

Information
Toomas Soome
illumos-gate
10721
5be3e60...
Reviewers
general
../../common/io/ib/ibnex/ibnex_ioctl.c: In function 'ibnex_ctl_query_hca':
../../common/io/ib/ibnex/ibnex_ioctl.c:2950:22: error: pointer/integer type mismatch in conditional expression [-Werror]
      ? (device_path) : NULL;     \
                      ^
../../common/io/ib/ibnex/ibnex_ioctl.c:3026:3: note: in expansion of macro 'IBNEX_CTL_CP_HCA_INFO'
   IBNEX_CTL_CP_HCA_INFO(&query_hca_32->hca_info, hca_attr,
   ^~~~~~~~~~~~~~~~~~~~~
../../common/io/ib/ibnex/ibnex_ioctl.c:2949:23: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
  (x)->hca_device_path = ((device_path_alloc_sz) >= (device_path_len)) \
                       ^
../../common/io/ib/ibnex/ibnex_ioctl.c:3026:3: note: in expansion of macro 'IBNEX_CTL_CP_HCA_INFO'
   IBNEX_CTL_CP_HCA_INFO(&query_hca_32->hca_info, hca_attr,
   ^~~~~~~~~~~~~~~~~~~~~

In file included from ../../common/sys/param.h:48:0,
                 from ../../common/sys/t_lock.h:38,
                 from ../../common/sys/conf.h:37,
                 from ../../common/io/ib/ibnex/ibnex.c:46:
../../common/io/ib/ibnex/ibnex.c: In function 'ibnex_attach':
../../common/sys/null.h:32:14: error: passing argument 6 of 'ddi_prop_create' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../../common/io/ib/ibnex/ibnex.c:529:43: note: in expansion of macro 'NULL'
      "pm-want-child-notification?", NULL, NULL) != DDI_PROP_SUCCESS) {
                                           ^~~~
In file included from ../../common/sys/esunddi.h:29:0,
                 from ../../common/sys/sunmdi.h:33,
                 from ../../common/sys/mdi_impldefs.h:32,
                 from ../../common/io/ib/ibnex/ibnex.c:50:
../../common/sys/sunddi.h:935:1: note: expected 'int' but argument is of type 'void *'
 ddi_prop_create(dev_t dev, dev_info_t *dip, int flag,
 ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

  

Issues

  • 2
  • 0
  • 0
  • 2
Description From Last Updated
Are we ok that __typeof is a non-standard extension? Robert Mustacchi Robert Mustacchi
How portable is typeof? Is that gcc-only? If a device_path type (caddr32_t?) often needs to be compared with zero, you ... Gordon Ross Gordon Ross
Toomas Soome
Robert Mustacchi
Toomas Soome
Review request changed

Change Summary:

use typeof

Commit:

-223517e824ba098507601bdfbd74f8ccf7af6499
+5be3e604d4c3ea0654144d012307170faad1811b

Diff:

Revision 3 (+21 -21)

Show changes

Gordon Ross

   

How portable is typeof? Is that gcc-only?

If a device_path type (caddr32_t?) often needs to be compared with zero, you might considering adding a define DEVICE_PATH_NULL somewhere and use that.
(and in that case, I'd probably just ifdef the define)

Loading...