Print this page
6141 use kmem_zalloc instead of kmem_alloc + bzero/memset

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/pckt.c
          +++ new/usr/src/uts/common/io/pckt.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21   */
  22   22  /*
  23   23   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   28  /*        All Rights Reserved   */
  29   29  
  30   30  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"        /* from S5R4 1.10 */
  32      -
  33   31  /*
  34   32   * Description: The pckt module packetizes messages on
  35   33   *              its read queue by pre-fixing an M_PROTO
  36   34   *              message type to certain incoming messages.
  37   35   */
  38   36  
  39   37  #include <sys/types.h>
  40   38  #include <sys/param.h>
  41   39  #include <sys/stream.h>
  42   40  #include <sys/stropts.h>
↓ open down ↓ 174 lines elided ↑ open up ↑
 217  215                  return (EINVAL);
 218  216  
 219  217          if (q->q_ptr != NULL) {
 220  218                  /* It's already attached. */
 221  219                  return (0);
 222  220          }
 223  221  
 224  222          /*
 225  223           * Allocate state structure.
 226  224           */
 227      -        pip = kmem_alloc(sizeof (*pip), KM_SLEEP);
 228      -        bzero(pip, sizeof (*pip));
      225 +        pip = kmem_zalloc(sizeof (*pip), KM_SLEEP);
 229  226  
 230  227  #ifdef _MULTI_DATAMODEL
 231  228          pip->model = ddi_model_convert_from(get_udatamodel());
 232  229  #endif /* _MULTI_DATAMODEL */
 233  230  
 234  231          /*
 235  232           * Cross-link.
 236  233           */
 237  234          pip->pi_qptr = q;
 238  235          q->q_ptr = pip;
↓ open down ↓ 457 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX