Print this page
10703 smatch unreachable code checking needs reworking
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*




  28  * Map file parsing, Version 2 syntax (solaris).
  29  */
  30 #include        <stdio.h>
  31 #include        <unistd.h>
  32 #include        <ctype.h>
  33 #include        <sys/elf_amd64.h>   /* SHF_AMD64_LARGE */
  34 #include        <elfcap.h>
  35 #include        "msg.h"
  36 #include        "_libld.h"
  37 #include        "_map.h"
  38 
  39 /*
  40  * Use a case insensitive string match when looking up capability mask
  41  * values by name, and omit the AV_ prefix.
  42  */
  43 #define ELFCAP_STYLE ELFCAP_STYLE_LC | ELFCAP_STYLE_F_ICMP
  44 
  45 /*
  46  * Signature for functions used to parse top level mapfile directives
  47  */


3301                                 goto bad_dirtok;
3302 
3303                         /* Call the function associated with this directive */
3304                         if (tldir->func(mf) == TK_ERROR)
3305                                 return (FALSE);
3306                         break;
3307                 default:
3308                 bad_dirtok:
3309                         {
3310                                 char buf[VLA_SIZE(dirlist_bufsize)];
3311 
3312                                 mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_DIR),
3313                                     ld_map_kwnames(dirlist,
3314                                     SGSOFFSETOF(tldir_t, name),
3315                                     sizeof (dirlist[0]), buf, dirlist_bufsize),
3316                                     ld_map_tokenstr(tok, &tkv, &inv_buf));
3317                         }
3318                         return (FALSE);
3319                 }
3320         }
3321 
3322         /*NOTREACHED*/
3323         assert(0);
3324         return (FALSE);
3325 }


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2019 Joyent, Inc.
  29  */
  30 
  31 /*
  32  * Map file parsing, Version 2 syntax (solaris).
  33  */
  34 #include        <stdio.h>
  35 #include        <unistd.h>
  36 #include        <ctype.h>
  37 #include        <sys/elf_amd64.h>   /* SHF_AMD64_LARGE */
  38 #include        <elfcap.h>
  39 #include        "msg.h"
  40 #include        "_libld.h"
  41 #include        "_map.h"
  42 
  43 /*
  44  * Use a case insensitive string match when looking up capability mask
  45  * values by name, and omit the AV_ prefix.
  46  */
  47 #define ELFCAP_STYLE ELFCAP_STYLE_LC | ELFCAP_STYLE_F_ICMP
  48 
  49 /*
  50  * Signature for functions used to parse top level mapfile directives
  51  */


3305                                 goto bad_dirtok;
3306 
3307                         /* Call the function associated with this directive */
3308                         if (tldir->func(mf) == TK_ERROR)
3309                                 return (FALSE);
3310                         break;
3311                 default:
3312                 bad_dirtok:
3313                         {
3314                                 char buf[VLA_SIZE(dirlist_bufsize)];
3315 
3316                                 mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_DIR),
3317                                     ld_map_kwnames(dirlist,
3318                                     SGSOFFSETOF(tldir_t, name),
3319                                     sizeof (dirlist[0]), buf, dirlist_bufsize),
3320                                     ld_map_tokenstr(tok, &tkv, &inv_buf));
3321                         }
3322                         return (FALSE);
3323                 }
3324         }




3325 }