Project

General

Profile

Actions

Bug #9902

closed

mac: mac_soft_ring_poll should use size_t

Added by Toomas Soome over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

gcc 8 build of ip module is complaining:

../../common/inet/ip/ip_squeue.c: In function 'ip_squeue_add_ring':
../../common/inet/ip/ip_squeue.c:511:19: error: cast between incompatible function types from 'mac_receive_t' {aka 'struct msgb * (*)(void *, int)'} to 'mblk_t * (*)(void *, size_t)' {aka 'struct msgb * (*)(void *, long unsigned int)'} [-Werror=cast-function-type]
  rx_ring->rr_rx = (ip_mac_rx_t)mrfp->mrf_receive;
                   ^

Investigating the issue revealed that this is the link between ip and mac modules, and we are in fact relying on type mac_receive_t and the implementation of mac_soft_ring_poll() function.
There is apparent bug, the ip module is using size_t for bytes_to_pickup while mac_soft_ring_poll is defined to int mac_soft_ring_poll, but the mac_soft_ring_poll() is using argument to compare other variables of type size_t. Therefore mac_soft_ring_poll() should in fact be defined as mac_soft_ring_poll(mac_soft_ring_t *ringp, size_t bytes_to_pickup). Also the ip module is calling this function with argument with type of size_t.


Related issues

Related to illumos gate - Bug #9903: qinfo: add typed membersClosedToomas Soome2018-10-16

Actions
Actions #1

Updated by Toomas Soome over 4 years ago

  • Related to Bug #9903: qinfo: add typed members added
Actions #2

Updated by Electric Monk over 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 7ec6bfcf4280022b95218f03e28fb50217e4b6ff

commit  7ec6bfcf4280022b95218f03e28fb50217e4b6ff
Author: Toomas Soome <tsoome@me.com>
Date:   2018-11-09T15:07:54.000Z

    9902 mac: mac_soft_ring_poll should use size_t
    Reviewed by: Yuri Pankov <yuripv@yuripv.net>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Ryan Zezeski <ryan.zeseski@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF