10436 eventfd: NULL pointer errors

Review Request #1505 — Created Feb. 22, 2019 and submitted

tsoome
illumos-gate
10436
9a21503...
general
../../common/io/eventfd.c: In function 'eventfd_open':
../../common/io/eventfd.c:72:10: error: return makes integer from pointer without a cast [-Werror=int-conversion]
   return (NULL);
          ^
In file included from ../../common/sys/param.h:48:0,
                 from ../../common/sys/t_lock.h:38,
                 from ../../common/sys/map.h:35,
                 from ../../common/sys/ddi.h:37,
                 from ../../common/io/eventfd.c:21:
../../common/io/eventfd.c: In function 'eventfd_attach':
../../common/sys/null.h:32:14: error: passing argument 6 of 'ddi_create_minor_node' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../../common/io/eventfd.c:322:39: note: in expansion of macro 'NULL'
      EVENTFDMNRN_EVENTFD, DDI_PSEUDO, NULL) == DDI_FAILURE) {
                                       ^~~~
In file included from ../../common/io/eventfd.c:22:0:
../../common/sys/sunddi.h:1564:1: note: expected 'int' but argument is of type 'void *'
 ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type,
 ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
alarcher
  1. Ship It!
  2. 
      
andy_js
  1. Ship It!
  2. 
      
rm
  1. 
      
  2. usr/src/uts/common/io/eventfd.c (Diff revision 1)
     
     
    I believe this is actually a bug and it shouldn't return zero, but probably EAGAIN or ENOMEM or similar. Otherwise, we're indicating that the handle open succeeded; however, we don't have any soft state for that minor.
    1. I have to agree with Robert.
      Based on the ddi_soft_state_zalloc (9F) manual page, ddi_soft_state_zalloc will fail if:

      • the state parameter was invalid,
      • the item number was negative or
      • when an attempt was made to allocate an item number that was already allocated.

      These failure cases relates to invalid paramaters passed to ddi_soft_state_zalloc, so I think this line should be:

              return (EINVAL);
      
  3. 
      
pmooney
  1. 
      
  2. usr/src/uts/common/io/eventfd.c (Diff revision 1)
     
     

    I chatted with Robert and Bryan about this (and the timerfd_open) case, and the consensus was that ENXIO would be the appropriate error to emit here.

  3. 
      
tsoome
domag02
  1. Ship It!
  2. 
      
pmooney
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...