Unnamed: 0
int64 0
535k
| source
stringlengths 50
89.8k
| target
stringlengths 23
37.7k
|
---|---|---|
4,600 | CWE-000 static void i440fx_write ( int func , int addr , uint8_t val , void * priv ) { if ( func ) return ; if ( ( addr >= 0x10 ) && ( addr < 0x4f ) ) return ; switch ( addr ) { case 0x00 : case 0x01 : case 0x02 : case 0x03 : case 0x08 : case 0x09 : case 0x0a : case 0x0b : case 0x0c : case 0x0e : return ; case 0x04 : val &= 0x02 ; val |= 0x04 ; break ; case 0x05 : val = 0 ; break ; case 0x06 : val = 0 ; break ; case 0x07 : val &= 0x80 ; val |= 0x02 ; break ; case 0x59 : if ( ( card_i440fx [ 0x59 ] ^ val ) & 0xf0 ) { i440fx_map ( 0xf0000 , 0x10000 , val >> 4 ) ; shadowbios = ( val & 0x10 ) ; } break ; case 0x5a : if ( ( card_i440fx [ 0x5a ] ^ val ) & 0x0f ) i440fx_map ( 0xc0000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5a ] ^ val ) & 0xf0 ) i440fx_map ( 0xc4000 , 0x04000 , val >> 4 ) ; break ; case 0x5b : if ( ( card_i440fx [ 0x5b ] ^ val ) & 0x0f ) i440fx_map ( 0xc8000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5b ] ^ val ) & 0xf0 ) i440fx_map ( 0xcc000 , 0x04000 , val >> 4 ) ; break ; case 0x5c : if ( ( card_i440fx [ 0x5c ] ^ val ) & 0x0f ) i440fx_map ( 0xd0000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5c ] ^ val ) & 0xf0 ) i440fx_map ( 0xd4000 , 0x04000 , val >> 4 ) ; break ; case 0x5d : if ( ( card_i440fx [ 0x5d ] ^ val ) & 0x0f ) i440fx_map ( 0xd8000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5d ] ^ val ) & 0xf0 ) i440fx_map ( 0xdc000 , 0x04000 , val >> 4 ) ; break ; case 0x5e : if ( ( card_i440fx [ 0x5e ] ^ val ) & 0x0f ) i440fx_map ( 0xe0000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5e ] ^ val ) & 0xf0 ) i440fx_map ( 0xe4000 , 0x04000 , val >> 4 ) ; break ; case 0x5f : if ( ( card_i440fx [ 0x5f ] ^ val ) & 0x0f ) i440fx_map ( 0xe8000 , 0x04000 , val & 0xf ) ; if ( ( card_i440fx [ 0x5f ] ^ val ) & 0xf0 ) i440fx_map ( 0xec000 , 0x04000 , val >> 4 ) ; break ; <S2SV_StartBug> } <S2SV_EndBug> card_i440fx [ addr ] = val ; } | <S2SV_ModStart> ; break ; case 0x72 : if ( ( card_i440fx [ 0x72 ] ^ val ) & 0x48 ) i440fx_map ( 0xa0000 , 0x20000 , ( ( val & 0x48 ) == 0x48 ) ? 3 : 0 ) ; break ; |
4,601 | CWE-000 void userinit ( void ) { struct proc * p ; extern char _binary_initcode_start [ ] , _binary_initcode_size [ ] ; p = allocproc ( ) ; initproc = p ; if ( ( p -> pgdir = setupkvm ( ) ) == 0 ) panic ( "userinit:<S2SV_blank>out<S2SV_blank>of<S2SV_blank>memory?" ) ; inituvm ( p -> pgdir , _binary_initcode_start , ( int ) _binary_initcode_size ) ; p -> sz = PGSIZE ; memset ( p -> tf , 0 , sizeof ( * p -> tf ) ) ; p -> tf -> cs = ( SEG_UCODE << 3 ) | DPL_USER ; p -> tf -> ds = ( SEG_UDATA << 3 ) | DPL_USER ; p -> tf -> es = p -> tf -> ds ; p -> tf -> ss = p -> tf -> ds ; p -> tf -> eflags = FL_IF ; p -> tf -> esp = PGSIZE ; p -> tf -> eip = 0 ; safestrcpy ( p -> name , "initcode" , sizeof ( p -> name ) ) ; p -> cwd = namei ( "/" ) ; acquire ( & ptable . lock ) ; p -> state = RUNNABLE ; <S2SV_StartBug> if ( policy == 2 ) <S2SV_EndBug> <S2SV_StartBug> insert ( p ) ; <S2SV_EndBug> release ( & ptable . lock ) ; } | <S2SV_ModStart> = RUNNABLE ; # ifdef FRR <S2SV_ModEnd> insert ( p <S2SV_ModStart> p ) ; # endif |
4,602 | CWE-000 <S2SV_StartBug> static uint16_t circ_remove ( circbuf_t * buf ) { <S2SV_EndBug> if ( buf -> start == buf -> end ) return CIRC_EOF ; uint8_t c = buf -> data [ buf -> start ] ; buf -> start ++ ; if ( buf -> start == buf -> capacity ) { buf -> start = 0 ; } return c ; } | <S2SV_ModStart> uint16_t circ_remove ( volatile |
4,603 | CWE-000 void ftpserver_main_loop ( void ) { int serverSocket = 0 ; int cmd = 0 ; bool network_down = false ; serverSocket = network_create_serversocket ( TCP_PORT ) ; if ( serverSocket >= 0 ) console_printf ( "Listening<S2SV_blank>on<S2SV_blank>port<S2SV_blank>%d" , TCP_PORT ) ; <S2SV_StartBug> while ( serverSocket >= 0 && ! network_down ) <S2SV_EndBug> { <S2SV_StartBug> network_down = ftp_network_handler ( serverSocket ) ; <S2SV_EndBug> cmd = input_handler ( ) ; switch ( cmd ) { case VPAD_CMD_EXIT : console_printf ( "Executing<S2SV_blank>shutdown<S2SV_blank>command" ) ; network_down = true ; break ; case VPAD_CMD_REMOUNT : console_printf ( "Remounting<S2SV_blank>filesystems" ) ; remount_filesystems ( ) ; break ; } } <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> TCP_PORT ) ; else { console_printf ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>server<S2SV_blank>socket<S2SV_blank>(%d),<S2SV_blank>terminating..." , serverSocket ) ; } <S2SV_ModStart> ftp_network_handler ( serverSocket ) ; if ( network_down ) console_printf ( "encountered<S2SV_blank>a<S2SV_blank>fatal<S2SV_blank>network<S2SV_blank>error,<S2SV_blank>terminating..." <S2SV_ModStart> ; } } usleep ( 5000000 ) ; |
4,604 | CWE-000 int rmnet_set_link_ingress_data_format_tailspace ( rmnetctl_hndl_t * hndl , uint32_t ingress_flags , uint8_t tail_spacing , const char * dev_name , uint16_t * error_code ) { struct rmnet_nl_msg_s request , response ; int str_len = - 1 , return_code = RMNETCTL_LIB_ERR ; do { <S2SV_StartBug> if ( ( ! hndl ) || ( ! error_code ) || _rmnetctl_check_dev_name ( dev_name ) ) { <S2SV_EndBug> return_code = RMNETCTL_INVALID_ARG ; break ; } request . message_type = RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT ; request . arg_length = RMNET_MAX_STR_LEN + sizeof ( uint32_t ) + sizeof ( uint16_t ) + sizeof ( uint16_t ) ; str_len = strlcpy ( ( char * ) ( request . data_format . dev ) , dev_name , RMNET_MAX_STR_LEN ) ; if ( _rmnetctl_check_len ( str_len , error_code ) != RMNETCTL_SUCCESS ) break ; request . data_format . flags = ingress_flags ; request . data_format . tail_spacing = tail_spacing ; if ( ( * error_code = rmnetctl_transact ( hndl , & request , & response ) ) != RMNETCTL_SUCCESS ) break ; if ( _rmnetctl_check_code ( response . crd , error_code ) != RMNETCTL_SUCCESS ) break ; return_code = _rmnetctl_set_codes ( response . return_code , error_code ) ; } while ( 0 ) ; return return_code ; } | <S2SV_ModStart> ( dev_name ) || ( ( ~ INGRESS_FLAGS_MASK ) & ingress_flags ) |
4,605 | CWE-000 bool check_deps ( cell_t * c ) { <S2SV_StartBug> bool ret = true ; <S2SV_EndBug> if ( c && is_cell ( c ) ) { traverse ( c , { <S2SV_StartBug> if ( * p && ( * p ) -> expr . arg [ 0 ] != c ) { <S2SV_EndBug> printf ( "bad<S2SV_blank>dep<S2SV_blank>%d<S2SV_blank>-><S2SV_blank>%d,<S2SV_blank>should<S2SV_blank>be<S2SV_blank>%d\\n" , <S2SV_StartBug> ( int ) ( * p - cells ) , <S2SV_EndBug> <S2SV_StartBug> ( int ) ( ( * p ) -> expr . arg [ 0 ] - cells ) , <S2SV_EndBug> ( int ) ( c - cells ) ) ; ret = false ; } } , ARGS_OUT ) ; traverse ( c , { if ( ! check_deps ( * p ) ) ret = false ; } , ARGS_IN | ALT | PTRS ) ; } return ret ; } | <S2SV_ModStart> ret = true ; c = clear_ptr ( c ) <S2SV_ModStart> c , { cell_t * x = clear_ptr <S2SV_ModEnd> ( * p <S2SV_ModStart> * p ) ; if ( x && x <S2SV_ModStart> int ) ( x <S2SV_ModEnd> - cells ) <S2SV_ModStart> int ) ( x <S2SV_ModEnd> -> expr . |
4,606 | CWE-000 void RB_RenderDrawSurfList ( drawSurf_t * drawSurfs , int numDrawSurfs ) { shader_t * shader , * oldShader ; int fogNum , oldFogNum ; int entityNum , oldEntityNum ; int frontFace ; int dlighted , oldDlighted ; qboolean depthRange , oldDepthRange ; int i ; drawSurf_t * drawSurf ; int oldSort ; double originalTime = backEnd . refdef . floatTime ; RB_BeginDrawingView ( ) ; oldEntityNum = - 1 ; backEnd . currentEntity = & tr . worldEntity ; oldShader = NULL ; oldFogNum = - 1 ; oldDepthRange = qfalse ; oldDlighted = qfalse ; oldSort = - 1 ; depthRange = qfalse ; backEnd . pc . c_surfaces += numDrawSurfs ; for ( i = 0 , drawSurf = drawSurfs ; i < numDrawSurfs ; i ++ , drawSurf ++ ) { if ( drawSurf -> sort == oldSort ) { <S2SV_StartBug> rb_surfaceTable [ * drawSurf -> surface ] ( drawSurf -> surface ) ; <S2SV_EndBug> continue ; } oldSort = drawSurf -> sort ; R_DecomposeSort ( drawSurf -> sort , & entityNum , & shader , & fogNum , & frontFace , & dlighted ) ; if ( shader && ( shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted || ( entityNum != oldEntityNum && ! shader -> entityMergable ) ) ) { if ( oldShader != NULL ) { RB_EndSurface ( ) ; } RB_BeginSurface ( shader , fogNum ) ; oldShader = shader ; oldFogNum = fogNum ; oldDlighted = dlighted ; } if ( entityNum != oldEntityNum ) { depthRange = qfalse ; if ( entityNum != ENTITYNUM_WORLD ) { backEnd . currentEntity = & backEnd . refdef . entities [ entityNum ] ; backEnd . refdef . floatTime = originalTime ; R_RotateForEntity ( backEnd . currentEntity , & backEnd . viewParms , & backEnd . orientation ) ; if ( backEnd . currentEntity -> needDlights ) { R_TransformDlights ( backEnd . refdef . num_dlights , backEnd . refdef . dlights , & backEnd . orientation ) ; } if ( backEnd . currentEntity -> e . renderfx & RF_DEPTHHACK ) { depthRange = qtrue ; } } else { backEnd . currentEntity = & tr . worldEntity ; backEnd . refdef . floatTime = originalTime ; backEnd . orientation = backEnd . viewParms . world ; R_TransformDlights ( backEnd . refdef . num_dlights , backEnd . refdef . dlights , & backEnd . orientation ) ; } qglLoadMatrixf ( backEnd . orientation . modelMatrix ) ; if ( oldDepthRange != depthRange ) { if ( depthRange ) { qglDepthRange ( 0 , 0.3 ) ; } else { qglDepthRange ( 0 , 1 ) ; } oldDepthRange = depthRange ; } oldEntityNum = entityNum ; } <S2SV_StartBug> rb_surfaceTable [ * drawSurf -> surface ] ( drawSurf -> surface ) ; <S2SV_EndBug> } <S2SV_StartBug> if ( oldShader != NULL ) <S2SV_EndBug> { RB_EndSurface ( ) ; } backEnd . currentEntity = & tr . worldEntity ; backEnd . refdef . floatTime = originalTime ; backEnd . orientation = backEnd . viewParms . world ; R_TransformDlights ( backEnd . refdef . num_dlights , backEnd . refdef . dlights , & backEnd . orientation ) ; qglLoadMatrixf ( backEnd . viewParms . world . modelMatrix ) ; if ( depthRange ) { qglDepthRange ( 0 , 1 ) ; } RB_DrawSun ( ) ; RB_ShadowFinish ( ) ; RB_RenderFlares ( ) ; } | <S2SV_ModStart> oldSort ) { if ( * drawSurf -> surface < SF_NUM_SURFACE_TYPES ) { <S2SV_ModStart> surface ) ; } else { Com_Printf ( "^3Warning:<S2SV_blank>RB_RenderDrawSurfList<S2SV_blank>skipping<S2SV_blank>invalid<S2SV_blank>surface<S2SV_blank>[%i]<S2SV_blank>-<S2SV_blank>i<S2SV_blank>[%i]\\n" , * drawSurf -> surface , i ) ; } <S2SV_ModStart> entityNum ; } if ( * drawSurf -> surface < SF_NUM_SURFACE_TYPES ) { <S2SV_ModStart> ) ; } else { Com_Printf ( "^3Warning:<S2SV_blank>RB_RenderDrawSurfList<S2SV_blank>skipping<S2SV_blank>invalid<S2SV_blank>surface<S2SV_blank>[%i]<S2SV_blank>-<S2SV_blank>entity/old[%i:%i]<S2SV_blank>-<S2SV_blank>i<S2SV_blank>[%i]<S2SV_blank>shader<S2SV_blank>[%s]\\n" , * drawSurf -> surface , entityNum , oldEntityNum , i , shader -> name ) ; } } |
4,607 | CWE-000 int SemV ( int semaphore ) { USLOSS_Sysargs sysArg ; CHECKMODE ; sysArg . number = SYS_SEMV ; <S2SV_StartBug> sysArg . arg1 = ( void * ) semaphore ; <S2SV_EndBug> USLOSS_Syscall ( & sysArg ) ; <S2SV_StartBug> return ( int ) ( ( long ) sysArg . arg4 ) ; <S2SV_EndBug> } | <S2SV_ModStart> void * ) ( ( long ) semaphore ) <S2SV_ModEnd> ; USLOSS_Syscall ( <S2SV_ModStart> ; return ( <S2SV_ModEnd> long ) sysArg <S2SV_ModStart> sysArg . arg4 <S2SV_ModEnd> ; } <S2SV_null> |
4,608 | CWE-000 LogProtoServer * log_proto_multiline_server_new ( LogTransport * transport , const LogProtoMultiLineServerOptions * options ) { switch ( options -> mode ) { case MLM_INDENTED : return log_proto_indented_multiline_server_new ( transport , & options -> super ) ; case MLM_PREFIX_GARBAGE : return log_proto_prefix_garbage_multiline_server_new ( transport , & options -> super , options -> prefix , options -> garbage ) ; case MLM_PREFIX_SUFFIX : return log_proto_prefix_suffix_multiline_server_new ( transport , & options -> super , options -> prefix , options -> garbage ) ; case MLM_NONE : return log_proto_text_server_new ( transport , & options -> super ) ; <S2SV_StartBug> } <S2SV_EndBug> g_assert_not_reached ( ) ; } | <S2SV_ModStart> super ) ; default : g_assert_not_reached ( ) ; break ; |
4,609 | CWE-000 int intel_huc_auth ( struct intel_huc * huc ) { struct drm_i915_private * i915 = huc_to_i915 ( huc ) ; struct intel_guc * guc = & i915 -> guc ; struct i915_vma * vma ; u32 status ; int ret ; if ( huc -> fw . load_status != INTEL_UC_FIRMWARE_SUCCESS ) return - ENOEXEC ; vma = i915_gem_object_ggtt_pin ( huc -> fw . obj , NULL , 0 , 0 , <S2SV_StartBug> PIN_OFFSET_BIAS | guc -> ggtt_pin_bias ) ; <S2SV_EndBug> if ( IS_ERR ( vma ) ) { ret = PTR_ERR ( vma ) ; DRM_ERROR ( "HuC:<S2SV_blank>Failed<S2SV_blank>to<S2SV_blank>pin<S2SV_blank>huc<S2SV_blank>fw<S2SV_blank>object<S2SV_blank>%d\\n" , ret ) ; goto fail ; } ret = intel_guc_auth_huc ( guc , intel_guc_ggtt_offset ( guc , vma ) + huc -> fw . rsa_offset ) ; if ( ret ) { DRM_ERROR ( "HuC:<S2SV_blank>GuC<S2SV_blank>did<S2SV_blank>not<S2SV_blank>ack<S2SV_blank>Auth<S2SV_blank>request<S2SV_blank>%d\\n" , ret ) ; goto fail_unpin ; } ret = __intel_wait_for_register ( i915 , HUC_STATUS2 , HUC_FW_VERIFIED , HUC_FW_VERIFIED , 2 , 50 , & status ) ; if ( ret ) { DRM_ERROR ( "HuC:<S2SV_blank>Firmware<S2SV_blank>not<S2SV_blank>verified<S2SV_blank>%#x\\n" , status ) ; goto fail_unpin ; } i915_vma_unpin ( vma ) ; return 0 ; fail_unpin : i915_vma_unpin ( vma ) ; fail : huc -> fw . load_status = INTEL_UC_FIRMWARE_FAIL ; DRM_ERROR ( "HuC:<S2SV_blank>Authentication<S2SV_blank>failed<S2SV_blank>%d\\n" , ret ) ; return ret ; } | <S2SV_ModStart> , PIN_OFFSET_BIAS | i915 -> ggtt . pin_bias <S2SV_ModEnd> ) ; if |
4,610 | CWE-000 static gboolean handle_8021x_or_psk_auth_fail ( NMDeviceWifi * self , <S2SV_StartBug> guint32 new_state , <S2SV_EndBug> guint32 old_state , int disconnect_reason ) { NMDevice * device = NM_DEVICE ( self ) ; NMActRequest * req ; const char * setting_name = NULL ; gboolean handled = FALSE ; g_return_val_if_fail ( new_state == NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED , FALSE ) ; req = nm_device_get_act_request ( NM_DEVICE ( self ) ) ; g_return_val_if_fail ( req != NULL , FALSE ) ; if ( need_new_8021x_secrets ( self , old_state , & setting_name ) || need_new_wpa_psk ( self , old_state , disconnect_reason , & setting_name ) ) { nm_act_request_clear_secrets ( req ) ; _LOGI ( LOGD_DEVICE | LOGD_WIFI , "Activation:<S2SV_blank>(wifi)<S2SV_blank>disconnected<S2SV_blank>during<S2SV_blank>association,<S2SV_blank>asking<S2SV_blank>for<S2SV_blank>new<S2SV_blank>key" ) ; cleanup_association_attempt ( self , TRUE ) ; nm_device_state_changed ( device , NM_DEVICE_STATE_NEED_AUTH , NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT ) ; wifi_secrets_get_secrets ( self , setting_name , NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION | NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW ) ; handled = TRUE ; } return handled ; } | <S2SV_ModStart> * self , NMSupplicantInterfaceState new_state , NMSupplicantInterfaceState <S2SV_ModEnd> old_state , int |
4,611 | CWE-000 void redirectInputFile ( char * cmd [ MAX_ARGS ] , char * fileName ) { int fd2 = stdinToFile ( fileName ) ; if ( fd2 == - 1 ) { return ; } checkCmd ( cmd ) ; stdinToNormal ( fd2 ) ; <S2SV_StartBug> addVar ( "EXITCODE" , "0" ) ; <S2SV_EndBug> } | <S2SV_ModStart> fd2 ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
4,612 | CWE-000 shape * shapeCreateSphere ( scalar r ) { sphere * ret = ( sphere * ) malloc ( sizeof ( sphere ) ) ; ret -> s . type = SHAPE_SPHERE ; <S2SV_StartBug> ret -> s . restitution = 0.5f ; <S2SV_EndBug> <S2SV_StartBug> ret -> s . friction = 0.4f ; <S2SV_EndBug> ret -> radius = r ; sphereMass ( ret , 1 ) ; return ( shape * ) ret ; } | <S2SV_ModStart> . restitution = 0.6f <S2SV_ModEnd> ; ret -> <S2SV_ModStart> . friction = 0.1f <S2SV_ModEnd> ; ret -> |
4,613 | CWE-000 ParsingElement * Token_new ( const char * expr ) { TokenConfig * config = ( TokenConfig * ) malloc ( sizeof ( TokenConfig ) ) ; assert ( config != NULL ) ; ; ParsingElement * this = ParsingElement_new ( NULL ) ; this -> type = 'T' ; this -> recognize = Token_recognize ; this -> freeMatch = TokenMatch_free ; config -> expr = strdup ( expr ) ; assert ( config -> expr != NULL ) ; ; const char * pcre_error ; int pcre_error_offset = - 1 ; config -> regexp = pcre_compile ( config -> expr , PCRE_UTF8 , & pcre_error , & pcre_error_offset , NULL ) ; if ( pcre_error != NULL ) { fprintf ( stderr , "ERR<S2SV_blank>" ) ; fprintf ( stderr , "Token:<S2SV_blank>cannot<S2SV_blank>compile<S2SV_blank>regular<S2SV_blank>expression<S2SV_blank>`%s`<S2SV_blank>at<S2SV_blank>%d:<S2SV_blank>%s" , config -> expr , pcre_error_offset , pcre_error ) ; fprintf ( stderr , "\\n" ) ; ; <S2SV_StartBug> if ( config != NULL ) { ; free ( config ) ; } ; <S2SV_EndBug> if ( this != NULL ) { ; free ( this ) ; } ; return NULL ; } config -> extra = pcre_study ( config -> regexp , PCRE_STUDY_JIT_COMPILE , & pcre_error ) ; if ( pcre_error != NULL ) { fprintf ( stderr , "ERR<S2SV_blank>" ) ; fprintf ( stderr , "Token:<S2SV_blank>cannot<S2SV_blank>optimize<S2SV_blank>regular<S2SV_blank>expression<S2SV_blank>`%s`<S2SV_blank>at<S2SV_blank>%d:<S2SV_blank>%s" , config -> expr , pcre_error_offset , pcre_error ) ; fprintf ( stderr , "\\n" ) ; ; <S2SV_StartBug> if ( config != NULL ) { ; free ( config ) ; } ; <S2SV_EndBug> if ( this != NULL ) { ; free ( this ) ; } ; return NULL ; } this -> config = config ; assert ( strcmp ( config -> expr , expr ) == 0 ) ; assert ( strcmp ( Token_expr ( this ) , expr ) == 0 ) ; return this ; } | <S2SV_ModStart> ) { ; } ; if ( this != NULL ) { <S2SV_ModEnd> ; } ; <S2SV_ModStart> ) { ; } ; if ( this != NULL ) { <S2SV_ModEnd> ; } ; |
4,614 | CWE-000 static int function_check_flow ( bytecode_t * code , word len , word numvars , byte * checktable , word index , word * max_index , word * max_string , word recur , word exception_var ) { int err = 0 ; word found = 0 ; byte block_empty = 1 ; word val1 ; word val2 ; word val3 ; if ( recur > MAX_RECUR ) { ERROR ( - ERROR_RECUR ) ; } if ( index >= len ) { ERROR ( - ERROR_OP ) ; } while ( index < len ) { if ( code [ index ] . op >= FLOW_MAX ) { ERROR ( - ERROR_OP ) ; } switch ( code [ index ] . op ) { case OP_FLOW : DEBUG_PRINT_TABS ( recur ) ; val1 = code [ index ] . flow . val1 ; val2 = code [ index ] . flow . val2 ; val3 = code [ index ] . flow . val3 ; CHECK_CHECKTABLE ( index ) ; SET_CHECKTABLE ( index ) ; * max_index = MAX ( * max_index , index + 1 ) ; found ++ ; switch ( code [ index ] . flow . type ) { case FLOW_ASSIGN : if ( val1 >= numvars || code [ val1 ] . var . type == VAR_BUF || code [ val1 ] . var . type == VAR_ARRAY ) { ERROR ( - ERROR_VAR ) ; } if ( val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "%s%lu<S2SV_blank>=<S2SV_blank>" , variable_names [ code [ val1 ] . var . type ] , val1 ) ; CHECK_EXPRESSION ( val2 ) ; DEBUG_PRINT ( "\\n" ) ; break ; case FLOW_ASSIGN_OFFSET : if ( val1 >= numvars ) { ERROR ( - ERROR_VAR ) ; } if ( code [ val1 ] . var . type != VAR_BUF && code [ val1 ] . var . type != VAR_ARRAY && code [ val1 ] . var . type != VAR_POINTER ) { ERROR ( - ERROR_VAR ) ; } DEBUG_PRINT ( "%s%lu[" , variable_names [ code [ val1 ] . var . type ] , val1 ) ; CHECK_EXPRESSION ( val2 ) ; DEBUG_PRINT ( "]<S2SV_blank>=<S2SV_blank>" ) ; CHECK_EXPRESSION ( val3 ) ; DEBUG_PRINT ( "\\n" ) ; break ; case FLOW_IF : DEBUG_PRINT ( "if<S2SV_blank>" ) ; CHECK_EXPRESSION ( val1 ) ; DEBUG_PRINT ( ":\\n" ) ; CHECK_FLOW ( val2 ) ; DEBUG_PRINT_TABS ( recur ) ; DEBUG_PRINT ( "else:\\n" ) ; CHECK_FLOW ( val3 ) ; break ; case FLOW_TRY : if ( val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "try:\\n" ) ; CHECK_FLOW ( val1 ) ; DEBUG_PRINT_TABS ( recur ) ; DEBUG_PRINT ( "except:\\n" ) ; exception_var ++ ; CHECK_FLOW ( val2 ) ; exception_var -- ; break ; case FLOW_WHILE : if ( val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "while<S2SV_blank>" ) ; CHECK_EXPRESSION ( val1 ) ; DEBUG_PRINT ( ":\\n" ) ; CHECK_FLOW ( val2 ) ; break ; case FLOW_DYN_FREE : if ( val2 || val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "del(" ) ; CHECK_EXPRESSION ( val1 ) ; DEBUG_PRINT ( ")\\n" ) ; break ; case FLOW_SEND_DATA : if ( val1 >= numvars ) { ERROR ( - ERROR_VAR ) ; } <S2SV_StartBug> DEBUG_PRINT ( "send(%s%lu" , variable_names [ code [ val1 ] . var . type ] , val1 ) ; <S2SV_EndBug> if ( val2 ) { DEBUG_PRINT ( ",<S2SV_blank>[const%lu]" , val2 ) ; * max_string = MAX ( * max_string , val2 ) ; } DEBUG_PRINT ( ")\\n" ) ; break ; case FLOW_BLOCKEND : if ( val1 || val2 || val3 ) { ERROR ( - ERROR_PARAM ) ; } if ( ! recur ) { ERROR ( - ERROR_OP ) ; } if ( block_empty ) { DEBUG_PRINT ( "pass\\n\\n" ) ; } else { DEBUG_PRINT ( "\\n" ) ; } return found ; case FLOW_THROW : if ( val2 || val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "throw<S2SV_blank>" ) ; CHECK_EXPRESSION ( val1 ) ; DEBUG_PRINT ( "\\n\\n" ) ; return found ; case FLOW_RET : if ( ! val1 || val2 || val3 ) { ERROR ( - ERROR_PARAM ) ; } DEBUG_PRINT ( "return<S2SV_blank>" ) ; CHECK_EXPRESSION ( val1 ) ; DEBUG_PRINT ( "\\n\\n" ) ; return found ; default : ERROR ( - ERROR_OP ) ; } break ; case OP_VARIABLE : case OP_EXPRESSION : default : ERROR ( - ERROR_OP ) ; } block_empty = 0 ; index ++ ; } return - ERROR_FLOW ; } | <S2SV_ModStart> ) ; } if ( val3 >= ( 1 << PARAM_MAX ) ) { ERROR ( - ERROR_PARAM ) ; } |
4,615 | CWE-000 void sqlite3EndTable ( Parse * pParse , Token * pCons , Token * pEnd , Select * pSelect ) { Table * p ; sqlite3 * db = pParse -> db ; int iDb ; Index * pIdx ; if ( ( pEnd == 0 && pSelect == 0 ) || db -> mallocFailed ) { return ; } p = pParse -> pNewTable ; if ( p == 0 ) return ; assert ( ! db -> init . busy || ! pSelect ) ; iDb = sqlite3SchemaToIndex ( db , p -> pSchema ) ; # ifndef SQLITE_OMIT_CHECK if ( p -> pCheck ) { sqlite3ResolveSelfReference ( pParse , p , NC_IsCheck , 0 , p -> pCheck ) ; } # endif estimateTableWidth ( p ) ; for ( pIdx = p -> pIndex ; pIdx ; pIdx = pIdx -> pNext ) { estimateIndexWidth ( pIdx ) ; } if ( db -> init . busy ) { p -> tnum = db -> init . newTnum ; } if ( ! db -> init . busy ) { int n ; Vdbe * v ; char * zType ; char * zType2 ; char * zStmt ; v = sqlite3GetVdbe ( pParse ) ; if ( NEVER ( v == 0 ) ) return ; sqlite3VdbeAddOp1 ( v , OP_Close , 0 ) ; if ( p -> pSelect == 0 ) { zType = "table" ; zType2 = "TABLE" ; # ifndef SQLITE_OMIT_VIEW } else { zType = "view" ; zType2 = "VIEW" ; # endif } if ( pSelect ) { SelectDest dest ; Table * pSelTab ; assert ( pParse -> nTab == 1 ) ; sqlite3VdbeAddOp3 ( v , OP_OpenWrite , 1 , pParse -> regRoot , iDb ) ; sqlite3VdbeChangeP5 ( v , OPFLAG_P2ISREG ) ; pParse -> nTab = 2 ; sqlite3SelectDestInit ( & dest , SRT_Table , 1 ) ; sqlite3Select ( pParse , pSelect , & dest ) ; sqlite3VdbeAddOp1 ( v , OP_Close , 1 ) ; if ( pParse -> nErr == 0 ) { pSelTab = sqlite3ResultSetOfSelect ( pParse , pSelect ) ; if ( pSelTab == 0 ) return ; assert ( p -> aCol == 0 ) ; p -> nCol = pSelTab -> nCol ; p -> aCol = pSelTab -> aCol ; pSelTab -> nCol = 0 ; pSelTab -> aCol = 0 ; sqlite3DeleteTable ( db , pSelTab ) ; } } if ( pSelect ) { zStmt = createTableStmt ( db , p ) ; } else { n = ( int ) ( pEnd -> z - pParse -> sNameToken . z ) + 1 ; zStmt = sqlite3MPrintf ( db , "CREATE<S2SV_blank>%s<S2SV_blank>%.*s" , zType2 , n , pParse -> sNameToken . z ) ; } sqlite3NestedParse ( pParse , "UPDATE<S2SV_blank>%Q.%s<S2SV_blank>" "SET<S2SV_blank>type=\'%s\',<S2SV_blank>name=%Q,<S2SV_blank>tbl_name=%Q,<S2SV_blank>rootpage=#%d,<S2SV_blank>sql=%Q<S2SV_blank>" "WHERE<S2SV_blank>rowid=#%d" , db -> aDb [ iDb ] . zName , SCHEMA_TABLE ( iDb ) , zType , p -> zName , p -> zName , pParse -> regRoot , zStmt , pParse -> regRowid ) ; sqlite3DbFree ( db , zStmt ) ; sqlite3ChangeCookie ( pParse , iDb ) ; # ifndef SQLITE_OMIT_AUTOINCREMENT if ( p -> tabFlags & TF_Autoincrement ) { Db * pDb = & db -> aDb [ iDb ] ; assert ( sqlite3SchemaMutexHeld ( db , iDb , 0 ) ) ; if ( pDb -> pSchema -> pSeqTab == 0 ) { sqlite3NestedParse ( pParse , "CREATE<S2SV_blank>TABLE<S2SV_blank>%Q.sqlite_sequence(name,seq)" , pDb -> zName ) ; } } # endif sqlite3VdbeAddParseSchemaOp ( v , iDb , <S2SV_StartBug> sqlite3MPrintf ( db , "tbl_name=\'%q\'" , p -> zName ) ) ; <S2SV_EndBug> } if ( db -> init . busy ) { Table * pOld ; Schema * pSchema = p -> pSchema ; assert ( sqlite3SchemaMutexHeld ( db , iDb , 0 ) ) ; pOld = sqlite3HashInsert ( & pSchema -> tblHash , p -> zName , sqlite3Strlen30 ( p -> zName ) , p ) ; if ( pOld ) { assert ( p == pOld ) ; db -> mallocFailed = 1 ; return ; } pParse -> pNewTable = 0 ; db -> flags |= SQLITE_InternChanges ; # ifndef SQLITE_OMIT_ALTERTABLE if ( ! p -> pSelect ) { const char * zName = ( const char * ) pParse -> sNameToken . z ; int nName ; assert ( ! pSelect && pCons && pEnd ) ; if ( pCons -> z == 0 ) { pCons = pEnd ; } nName = ( int ) ( ( const char * ) pCons -> z - zName ) ; p -> addColOffset = 13 + sqlite3Utf8CharLen ( zName , nName ) ; } # endif } } | <S2SV_ModStart> ( db , "tbl_name=\'%q\'<S2SV_blank>AND<S2SV_blank>type!=\'trigger\'" <S2SV_ModEnd> , p -> |
4,616 | CWE-000 static gboolean gst_vaapi_window_wayland_render ( GstVaapiWindow * window , GstVaapiSurface * surface , const GstVaapiRectangle * src_rect , const GstVaapiRectangle * dst_rect , guint flags ) { GstVaapiWindowWaylandPrivate * const priv = GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE ( window ) ; GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY ( window ) ; struct wl_display * const wl_display = GST_VAAPI_OBJECT_NATIVE_DISPLAY ( window ) ; struct wl_buffer * buffer ; FrameState * frame ; guint width , height , va_flags ; VAStatus status ; gst_vaapi_surface_get_size ( surface , & width , & height ) ; if ( src_rect -> x != 0 || src_rect -> y != 0 ) priv -> need_vpp = TRUE ; if ( src_rect -> width != width || src_rect -> height != height ) priv -> need_vpp = TRUE ; if ( dst_rect -> x != 0 || dst_rect -> y != 0 ) priv -> need_vpp = TRUE ; if ( dst_rect -> width != window -> width || dst_rect -> height != window -> height ) priv -> need_vpp = TRUE ; if ( ! priv -> need_vpp ) { GST_VAAPI_OBJECT_LOCK_DISPLAY ( window ) ; va_flags = from_GstVaapiSurfaceRenderFlags ( flags ) ; status = vaGetSurfaceBufferWl ( GST_VAAPI_DISPLAY_VADISPLAY ( display ) , GST_VAAPI_OBJECT_ID ( surface ) , va_flags & ( VA_TOP_FIELD | VA_BOTTOM_FIELD ) , & buffer ) ; GST_VAAPI_OBJECT_UNLOCK_DISPLAY ( window ) ; if ( status == VA_STATUS_ERROR_FLAG_NOT_SUPPORTED || status == VA_STATUS_ERROR_UNIMPLEMENTED || status == VA_STATUS_ERROR_INVALID_IMAGE_FORMAT ) priv -> need_vpp = TRUE ; else if ( ! vaapi_check_status ( status , "vaGetSurfaceBufferWl()" ) ) return FALSE ; } if ( priv -> need_vpp ) { if ( window -> has_vpp ) { GstVaapiSurface * const vpp_surface = gst_vaapi_window_vpp_convert_internal ( window , surface , src_rect , dst_rect , flags ) ; if ( G_UNLIKELY ( ! vpp_surface ) ) priv -> need_vpp = FALSE ; else { surface = vpp_surface ; width = window -> width ; height = window -> height ; } } GST_VAAPI_OBJECT_LOCK_DISPLAY ( window ) ; status = vaGetSurfaceBufferWl ( GST_VAAPI_DISPLAY_VADISPLAY ( display ) , GST_VAAPI_OBJECT_ID ( surface ) , VA_FRAME_PICTURE , & buffer ) ; GST_VAAPI_OBJECT_UNLOCK_DISPLAY ( window ) ; if ( ! vaapi_check_status ( status , "vaGetSurfaceBufferWl()" ) ) return FALSE ; } if ( ! gst_vaapi_window_wayland_sync ( window ) ) { <S2SV_StartBug> wl_buffer_destroy ( buffer ) ; <S2SV_EndBug> return ! priv -> sync_failed ; } frame = frame_state_new ( window ) ; if ( ! frame ) return FALSE ; g_atomic_pointer_set ( & priv -> last_frame , frame ) ; g_atomic_int_inc ( & priv -> num_frames_pending ) ; if ( priv -> need_vpp && window -> has_vpp ) { frame -> surface = surface ; frame -> surface_pool = gst_vaapi_video_pool_ref ( window -> surface_pool ) ; } GST_VAAPI_OBJECT_LOCK_DISPLAY ( window ) ; wl_surface_attach ( priv -> surface , buffer , 0 , 0 ) ; wl_surface_damage ( priv -> surface , 0 , 0 , width , height ) ; if ( priv -> opaque_region ) { wl_surface_set_opaque_region ( priv -> surface , priv -> opaque_region ) ; wl_region_destroy ( priv -> opaque_region ) ; priv -> opaque_region = NULL ; } wl_proxy_set_queue ( ( struct wl_proxy * ) buffer , priv -> event_queue ) ; wl_buffer_add_listener ( buffer , & frame_buffer_listener , frame ) ; frame -> callback = wl_surface_frame ( priv -> surface ) ; wl_callback_add_listener ( frame -> callback , & frame_callback_listener , frame ) ; wl_surface_commit ( priv -> surface ) ; wl_display_flush ( wl_display ) ; GST_VAAPI_OBJECT_UNLOCK_DISPLAY ( window ) ; return TRUE ; } | <S2SV_ModStart> ) ) { if ( priv -> need_vpp && window -> has_vpp ) gst_vaapi_video_pool_put_object ( window -> surface_pool , surface ) ; |
4,617 | CWE-000 static int cpufreq_stats_create_table ( struct cpufreq_policy * policy , <S2SV_StartBug> struct cpufreq_frequency_table * table , int count ) <S2SV_EndBug> { unsigned int i , j , ret = 0 ; struct cpufreq_stats * stat ; struct cpufreq_policy * data ; <S2SV_StartBug> unsigned int alloc_size ; <S2SV_EndBug> unsigned int cpu = policy -> cpu ; struct cpufreq_stats * prev_stat = per_cpu ( prev_cpufreq_stats_table , cpu ) ; if ( per_cpu ( cpufreq_stats_table , cpu ) ) return - EBUSY ; stat = kzalloc ( sizeof ( struct cpufreq_stats ) , GFP_KERNEL ) ; if ( ( stat ) == NULL ) return - ENOMEM ; if ( prev_stat ) memcpy ( stat , prev_stat , sizeof ( * prev_stat ) ) ; data = cpufreq_cpu_get ( cpu ) ; if ( data == NULL ) { ret = - EINVAL ; goto error_get_fail ; } <S2SV_StartBug> ret = sysfs_create_group ( & data -> kobj , & stats_attr_group ) ; <S2SV_EndBug> if ( ret ) goto error_out ; stat -> cpu = cpu ; per_cpu ( cpufreq_stats_table , cpu ) = stat ; alloc_size = count * sizeof ( int ) + count * sizeof ( u64 ) ; # ifdef CONFIG_CPU_FREQ_STAT_DETAILS alloc_size += count * count * sizeof ( int ) ; # endif stat -> max_state = count ; stat -> time_in_state = kzalloc ( alloc_size , GFP_KERNEL ) ; if ( ! stat -> time_in_state ) { ret = - ENOMEM ; goto error_out ; } stat -> freq_table = ( unsigned int * ) ( stat -> time_in_state + count ) ; # ifdef CONFIG_CPU_FREQ_STAT_DETAILS stat -> trans_table = stat -> freq_table + count ; # endif j = 0 ; for ( i = 0 ; table [ i ] . frequency != CPUFREQ_TABLE_END ; i ++ ) { unsigned int freq = table [ i ] . frequency ; if ( freq == CPUFREQ_ENTRY_INVALID ) continue ; if ( freq_table_get_index ( stat , freq ) == - 1 ) stat -> freq_table [ j ++ ] = freq ; } stat -> state_num = j ; if ( prev_stat ) { memcpy ( stat -> time_in_state , prev_stat -> time_in_state , alloc_size ) ; kfree ( prev_stat -> time_in_state ) ; kfree ( prev_stat ) ; per_cpu ( prev_cpufreq_stats_table , cpu ) = NULL ; } spin_lock ( & cpufreq_stats_lock ) ; stat -> last_time = get_jiffies_64 ( ) ; atomic_set ( & stat -> cpu_freq_i , freq_table_get_index ( stat , policy -> cur ) ) ; spin_unlock ( & cpufreq_stats_lock ) ; cpufreq_cpu_put ( data ) ; return 0 ; error_out : cpufreq_cpu_put ( data ) ; error_get_fail : kfree ( stat ) ; per_cpu ( cpufreq_stats_table , cpu ) = NULL ; return ret ; } | <S2SV_ModStart> * policy , int cpu , <S2SV_ModStart> unsigned int alloc_size <S2SV_ModEnd> ; struct cpufreq_stats <S2SV_ModStart> & stats_attr_group ) <S2SV_ModEnd> ; stat -> |
4,618 | CWE-000 static boolean stw_st_framebuffer_validate ( struct st_context_iface * stctx , struct st_framebuffer_iface * stfb , const enum st_attachment_type * statts , unsigned count , struct pipe_resource * * out ) { struct stw_st_framebuffer * stwfb = stw_st_framebuffer ( stfb ) ; unsigned statt_mask , i ; statt_mask = 0x0 ; for ( i = 0 ; i < count ; i ++ ) statt_mask |= 1 << statts [ i ] ; stw_framebuffer_lock ( stwfb -> fb ) ; if ( stwfb -> fb -> must_resize || ( statt_mask & ~ stwfb -> texture_mask ) ) { stw_st_framebuffer_validate_locked ( & stwfb -> base , stwfb -> fb -> width , stwfb -> fb -> height , statt_mask ) ; stwfb -> fb -> must_resize = FALSE ; } <S2SV_StartBug> for ( i = 0 ; i < count ; i ++ ) { <S2SV_EndBug> out [ i ] = NULL ; pipe_resource_reference ( & out [ i ] , stwfb -> textures [ statts [ i ] ] ) ; <S2SV_StartBug> } <S2SV_EndBug> stw_framebuffer_unlock ( stwfb -> fb ) ; return TRUE ; } | <S2SV_ModStart> i ++ ) <S2SV_ModEnd> pipe_resource_reference ( & <S2SV_ModStart> ] ) ; <S2SV_ModEnd> stw_framebuffer_unlock ( stwfb |
4,619 | CWE-000 static int mcp3021_probe ( struct i2c_client * client , const struct i2c_device_id * id ) { int err ; struct mcp3021_data * data = NULL ; if ( ! i2c_check_functionality ( client -> adapter , I2C_FUNC_I2C ) ) return - ENODEV ; data = devm_kzalloc ( & client -> dev , sizeof ( struct mcp3021_data ) , GFP_KERNEL ) ; if ( ! data ) return - ENOMEM ; i2c_set_clientdata ( client , data ) ; switch ( id -> driver_data ) { case mcp3021 : data -> sar_shift = MCP3021_SAR_SHIFT ; data -> sar_mask = MCP3021_SAR_MASK ; data -> output_res = MCP3021_OUTPUT_RES ; <S2SV_StartBug> data -> output_scale = MCP3021_OUTPUT_SCALE ; <S2SV_EndBug> break ; case mcp3221 : data -> sar_shift = MCP3221_SAR_SHIFT ; data -> sar_mask = MCP3221_SAR_MASK ; <S2SV_StartBug> data -> output_res = MCP3221_OUTPUT_RES ; <S2SV_EndBug> data -> output_scale = MCP3221_OUTPUT_SCALE ; break ; } if ( client -> dev . platform_data ) { data -> vdd = * ( u32 * ) client -> dev . platform_data ; if ( data -> vdd > MCP3021_VDD_MAX || data -> vdd < MCP3021_VDD_MIN ) return - EINVAL ; } else data -> vdd = MCP3021_VDD_REF ; err = sysfs_create_file ( & client -> dev . kobj , & dev_attr_in0_input . attr ) ; if ( err ) return err ; data -> hwmon_dev = hwmon_device_register ( & client -> dev ) ; if ( IS_ERR ( data -> hwmon_dev ) ) { err = PTR_ERR ( data -> hwmon_dev ) ; goto exit_remove ; } return 0 ; exit_remove : sysfs_remove_file ( & client -> dev . kobj , & dev_attr_in0_input . attr ) ; return err ; } | <S2SV_ModStart> = MCP3021_OUTPUT_RES ; <S2SV_ModEnd> break ; case <S2SV_ModStart> output_res = MCP3221_OUTPUT_RES <S2SV_ModEnd> ; break ; |
4,620 | CWE-000 static void blk_set_cmd_filter_defaults ( struct blk_cmd_filter * filter ) { __set_bit ( TEST_UNIT_READY , filter -> read_ok ) ; __set_bit ( REQUEST_SENSE , filter -> read_ok ) ; __set_bit ( READ_6 , filter -> read_ok ) ; __set_bit ( READ_10 , filter -> read_ok ) ; __set_bit ( READ_12 , filter -> read_ok ) ; __set_bit ( READ_16 , filter -> read_ok ) ; __set_bit ( READ_BUFFER , filter -> read_ok ) ; __set_bit ( READ_DEFECT_DATA , filter -> read_ok ) ; __set_bit ( READ_CAPACITY , filter -> read_ok ) ; __set_bit ( READ_LONG , filter -> read_ok ) ; __set_bit ( INQUIRY , filter -> read_ok ) ; __set_bit ( MODE_SENSE , filter -> read_ok ) ; __set_bit ( MODE_SENSE_10 , filter -> read_ok ) ; __set_bit ( LOG_SENSE , filter -> read_ok ) ; __set_bit ( START_STOP , filter -> read_ok ) ; __set_bit ( GPCMD_VERIFY_10 , filter -> read_ok ) ; __set_bit ( VERIFY_16 , filter -> read_ok ) ; __set_bit ( REPORT_LUNS , filter -> read_ok ) ; __set_bit ( SERVICE_ACTION_IN_16 , filter -> read_ok ) ; __set_bit ( RECEIVE_DIAGNOSTIC , filter -> read_ok ) ; __set_bit ( MAINTENANCE_IN , filter -> read_ok ) ; __set_bit ( GPCMD_READ_BUFFER_CAPACITY , filter -> read_ok ) ; __set_bit ( GPCMD_PLAY_CD , filter -> read_ok ) ; __set_bit ( GPCMD_PLAY_AUDIO_10 , filter -> read_ok ) ; __set_bit ( GPCMD_PLAY_AUDIO_MSF , filter -> read_ok ) ; __set_bit ( GPCMD_PLAY_AUDIO_TI , filter -> read_ok ) ; __set_bit ( GPCMD_PAUSE_RESUME , filter -> read_ok ) ; __set_bit ( GPCMD_READ_CD , filter -> read_ok ) ; __set_bit ( GPCMD_READ_CD_MSF , filter -> read_ok ) ; __set_bit ( GPCMD_READ_DISC_INFO , filter -> read_ok ) ; __set_bit ( GPCMD_READ_CDVD_CAPACITY , filter -> read_ok ) ; __set_bit ( GPCMD_READ_DVD_STRUCTURE , filter -> read_ok ) ; __set_bit ( GPCMD_READ_HEADER , filter -> read_ok ) ; __set_bit ( GPCMD_READ_TRACK_RZONE_INFO , filter -> read_ok ) ; __set_bit ( GPCMD_READ_SUBCHANNEL , filter -> read_ok ) ; __set_bit ( GPCMD_READ_TOC_PMA_ATIP , filter -> read_ok ) ; __set_bit ( GPCMD_REPORT_KEY , filter -> read_ok ) ; __set_bit ( GPCMD_SCAN , filter -> read_ok ) ; __set_bit ( GPCMD_GET_CONFIGURATION , filter -> read_ok ) ; __set_bit ( GPCMD_READ_FORMAT_CAPACITIES , filter -> read_ok ) ; __set_bit ( GPCMD_GET_EVENT_STATUS_NOTIFICATION , filter -> read_ok ) ; __set_bit ( GPCMD_GET_PERFORMANCE , filter -> read_ok ) ; __set_bit ( GPCMD_SEEK , filter -> read_ok ) ; __set_bit ( GPCMD_STOP_PLAY_SCAN , filter -> read_ok ) ; __set_bit ( WRITE_6 , filter -> write_ok ) ; __set_bit ( WRITE_10 , filter -> write_ok ) ; __set_bit ( WRITE_VERIFY , filter -> write_ok ) ; __set_bit ( WRITE_12 , filter -> write_ok ) ; __set_bit ( WRITE_VERIFY_12 , filter -> write_ok ) ; __set_bit ( WRITE_16 , filter -> write_ok ) ; __set_bit ( WRITE_LONG , filter -> write_ok ) ; __set_bit ( WRITE_LONG_2 , filter -> write_ok ) ; <S2SV_StartBug> __set_bit ( ERASE , filter -> write_ok ) ; <S2SV_EndBug> __set_bit ( GPCMD_MODE_SELECT_10 , filter -> write_ok ) ; __set_bit ( MODE_SELECT , filter -> write_ok ) ; __set_bit ( LOG_SELECT , filter -> write_ok ) ; __set_bit ( GPCMD_BLANK , filter -> write_ok ) ; __set_bit ( GPCMD_CLOSE_TRACK , filter -> write_ok ) ; __set_bit ( GPCMD_FLUSH_CACHE , filter -> write_ok ) ; __set_bit ( GPCMD_FORMAT_UNIT , filter -> write_ok ) ; __set_bit ( GPCMD_REPAIR_RZONE_TRACK , filter -> write_ok ) ; __set_bit ( GPCMD_RESERVE_RZONE_TRACK , filter -> write_ok ) ; __set_bit ( GPCMD_SEND_DVD_STRUCTURE , filter -> write_ok ) ; __set_bit ( GPCMD_SEND_EVENT , filter -> write_ok ) ; __set_bit ( GPCMD_SEND_KEY , filter -> write_ok ) ; __set_bit ( GPCMD_SEND_OPC , filter -> write_ok ) ; __set_bit ( GPCMD_SEND_CUE_SHEET , filter -> write_ok ) ; __set_bit ( GPCMD_SET_SPEED , filter -> write_ok ) ; __set_bit ( GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL , filter -> write_ok ) ; __set_bit ( GPCMD_LOAD_UNLOAD , filter -> write_ok ) ; __set_bit ( GPCMD_SET_STREAMING , filter -> write_ok ) ; __set_bit ( GPCMD_SET_READ_AHEAD , filter -> write_ok ) ; } | <S2SV_ModStart> ; __set_bit ( WRITE_SAME , filter -> write_ok ) ; __set_bit ( WRITE_SAME_16 , filter -> write_ok ) ; __set_bit ( WRITE_SAME_32 , filter -> write_ok ) ; __set_bit ( |
4,621 | CWE-000 static int get_frame_info ( struct mips_frame_info * info ) { <S2SV_StartBug> # ifdef CONFIG_CPU_MICROMIPS <S2SV_EndBug> <S2SV_StartBug> union mips_instruction * ip = ( void * ) ( ( ( char * ) info -> func ) - 1 ) ; <S2SV_EndBug> # else union mips_instruction * ip = info -> func ; # endif unsigned max_insns = info -> func_size / sizeof ( union mips_instruction ) ; unsigned i ; info -> pc_offset = - 1 ; <S2SV_StartBug> info -> frame_size = 0 ; <S2SV_EndBug> if ( ! ip ) goto err ; if ( max_insns == 0 ) max_insns = 128U ; max_insns = min ( 128U , max_insns ) ; for ( i = 0 ; i < max_insns ; i ++ , ip ++ ) { if ( is_jump_ins ( ip ) ) break ; if ( ! info -> frame_size ) { if ( is_sp_move_ins ( ip ) ) { # ifdef CONFIG_CPU_MICROMIPS if ( mm_insn_16bit ( ip -> halfword [ 0 ] ) ) { unsigned short tmp ; if ( ip -> halfword [ 0 ] & mm_addiusp_func ) { tmp = ( ( ( ip -> halfword [ 0 ] >> 1 ) & 0x1ff ) << 2 ) ; info -> frame_size = - ( signed short ) ( tmp | ( ( tmp & 0x100 ) ? 0xfe00 : 0 ) ) ; } else { tmp = ( ip -> halfword [ 0 ] >> 1 ) ; info -> frame_size = - ( signed short ) ( tmp & 0xf ) ; } ip = ( void * ) & ip -> halfword [ 1 ] ; ip -- ; } else # endif info -> frame_size = - ip -> i_format . simmediate ; } continue ; } if ( info -> pc_offset == - 1 && is_ra_save_ins ( ip ) ) { info -> pc_offset = ip -> i_format . simmediate / sizeof ( long ) ; break ; } } if ( info -> frame_size && info -> pc_offset >= 0 ) return 0 ; if ( info -> pc_offset < 0 ) return 1 ; err : return - 1 ; } | <S2SV_ModStart> info ) { <S2SV_ModEnd> union mips_instruction * <S2SV_ModStart> mips_instruction * ip ; <S2SV_ModEnd> unsigned max_insns = <S2SV_ModStart> frame_size = 0 ; ip = ( void * ) msk_isa16_mode ( ( ulong ) info -> func ) |
4,622 | CWE-000 int main ( int argc , char * argv [ ] ) { sc_MPI_Comm mpicomm ; PetscInitialize ( & argc , & argv , ( char * ) 0 , NULL ) ; mpicomm = PETSC_COMM_WORLD ; int proc_size ; int proc_rank ; MPI_Comm_size ( mpicomm , & proc_size ) ; MPI_Comm_rank ( mpicomm , & proc_rank ) ; p4est_init ( NULL , SC_LP_ERROR ) ; d4est_geometry_t * d4est_geom = P4EST_ALLOC ( d4est_geometry_t , 1 ) ; d4est_geom -> geom_type = GEOM_BRICK ; d4est_geom -> DX_compute_method = GEOM_COMPUTE_ANALYTIC ; d4est_geom -> JAC_compute_method = GEOM_COMPUTE_NUMERICAL ; d4est_geometry_brick_new ( proc_rank , "test_d4est_amr.input" , "geometry" , "[Geometry]:" , d4est_geom ) ; p4est_t * p4est = problem_build_p4est ( mpicomm , d4est_geom -> p4est_conn , - 1 , <S2SV_StartBug> 0 , <S2SV_EndBug> 1 ) ; d4est_operators_t * d4est_ops = d4est_ops_init ( 20 ) ; d4est_mesh_geometry_storage_t * geometric_factors = d4est_mesh_geometry_storage_init ( p4est ) ; d4est_quadrature_t * d4est_quad = P4EST_ALLOC ( d4est_quadrature_t , 1 ) ; d4est_quad -> quad_type = QUAD_TYPE_GAUSS_LEGENDRE ; d4est_quadrature_legendre_new ( d4est_quad , d4est_geom , "" ) ; p4est_ghost_t * ghost = p4est_ghost_new ( p4est , P4EST_CONNECT_FACE ) ; d4est_element_data_t * ghost_data = P4EST_ALLOC ( d4est_element_data_t , ghost -> ghosts . elem_count ) ; d4est_amr_t * d4est_amr = d4est_amr_init ( p4est , "test_d4est_amr.input" , "[TEST_D4EST_AMR]:" , NULL ) ; int local_nodes = d4est_mesh_update ( p4est , ghost , ghost_data , d4est_ops , d4est_geom , d4est_quad , geometric_factors , INITIALIZE_QUADRATURE_DATA , INITIALIZE_GEOMETRY_DATA , INITIALIZE_GEOMETRY_ALIASES , problem_set_degrees_init , NULL ) ; double * poly_vec = P4EST_ALLOC ( double , local_nodes ) ; int same = 1 ; for ( int level = 0 ; level < d4est_amr -> num_of_amr_steps ; ++ level ) { local_nodes = d4est_mesh_update ( p4est , ghost , ghost_data , d4est_ops , d4est_geom , d4est_quad , geometric_factors , INITIALIZE_QUADRATURE_DATA , INITIALIZE_GEOMETRY_DATA , INITIALIZE_GEOMETRY_ALIASES , problem_set_degrees_amr , NULL ) ; printf ( "level<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>elements<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>nodes<S2SV_blank>=<S2SV_blank>%d\\n" , level , p4est -> local_num_quadrants , local_nodes ) ; if ( level == 0 ) { d4est_mesh_init_field ( p4est , poly_vec , poly_vec_fcn , d4est_ops , d4est_geom , NULL ) ; } else { double * poly_vec_compare = P4EST_ALLOC ( double , local_nodes ) ; d4est_mesh_init_field ( p4est , poly_vec_compare , poly_vec_fcn , d4est_ops , d4est_geom , NULL ) ; same = d4est_util_compare_vecs ( poly_vec , poly_vec_compare , local_nodes , D4EST_REAL_EPS ) ; if ( ! same ) { DEBUG_PRINT_2ARR_DBL ( poly_vec , poly_vec_compare , local_nodes ) ; } P4EST_FREE ( poly_vec_compare ) ; } if ( ! same ) break ; d4est_amr_step ( p4est , & ghost , & ghost_data , d4est_ops , d4est_amr , & poly_vec , NULL ) ; } P4EST_FREE ( poly_vec ) ; if ( ghost ) { p4est_ghost_destroy ( ghost ) ; P4EST_FREE ( ghost_data ) ; ghost = NULL ; ghost_data = NULL ; } d4est_mesh_geometry_storage_destroy ( geometric_factors ) ; d4est_quadrature_destroy ( p4est , d4est_ops , d4est_geom , d4est_quad ) ; d4est_amr_destroy ( d4est_amr ) ; d4est_ops_destroy ( d4est_ops ) ; p4est_destroy ( p4est ) ; d4est_geometry_destroy ( d4est_geom ) ; PetscFinalize ( ) ; if ( same ) return 0 ; else return 1 ; } | <S2SV_ModStart> - 1 , 1 <S2SV_ModEnd> , 1 ) |
4,623 | CWE-000 static int _ses_sg_paths_get ( char * err_msg , char * * * sg_paths , uint32_t * sg_count ) { int rc = LSM_ERR_OK ; uint32_t i = 0 ; DIR * dir = NULL ; struct dirent * dp = NULL ; lsm_string_list * sg_name_list = NULL ; const char * sg_name = NULL ; char * sysfs_sg_type_path = NULL ; char sg_dev_type [ _LINUX_SG_DEV_TYPE_SES_LEN + 1 ] ; ssize_t sg_dev_type_size = 0 ; char strerr_buff [ _LSM_ERR_MSG_LEN ] ; int tmp_rc = 0 ; assert ( err_msg != NULL ) ; assert ( sg_paths != NULL ) ; assert ( sg_count != NULL ) ; * sg_paths = NULL ; * sg_count = 0 ; sg_name_list = lsm_string_list_alloc ( 0 ) ; _alloc_null_check ( err_msg , sg_name_list , rc , out ) ; if ( ! _file_exists ( _SYSFS_SG_ROOT_PATH ) ) { rc = LSM_ERR_INVALID_ARGUMENT ; _lsm_err_msg_set ( err_msg , "Required<S2SV_blank>kernel<S2SV_blank>module<S2SV_blank>\'sg\'<S2SV_blank>not<S2SV_blank>loaded" ) ; goto out ; } dir = opendir ( _SYSFS_SG_ROOT_PATH ) ; if ( dir == NULL ) { _lsm_err_msg_set ( err_msg , "Cannot<S2SV_blank>open<S2SV_blank>%s:<S2SV_blank>error<S2SV_blank>(%d)%s" , _SYSFS_SG_ROOT_PATH , errno , strerror_r ( errno , strerr_buff , _LSM_ERR_MSG_LEN ) ) ; rc = LSM_ERR_LIB_BUG ; goto out ; } do { if ( ( dp = readdir ( dir ) ) != NULL ) { sg_name = dp -> d_name ; if ( ( sg_name == NULL ) || ( strlen ( sg_name ) == 0 ) || ( strncmp ( sg_name , "sg" , strlen ( "sg" ) ) != 0 ) ) continue ; sysfs_sg_type_path = ( char * ) <S2SV_StartBug> malloc ( sizeof ( char ) * ( sizeof ( _SYSFS_SG_ROOT_PATH ) + <S2SV_EndBug> strlen ( "/" ) + <S2SV_StartBug> sizeof ( sg_name ) + <S2SV_EndBug> strlen ( "/device/type" ) + 1 ) ) ; _alloc_null_check ( err_msg , sysfs_sg_type_path , rc , out ) ; sprintf ( sysfs_sg_type_path , "%s/%s/device/type" , _SYSFS_SG_ROOT_PATH , sg_name ) ; tmp_rc = _read_file ( sysfs_sg_type_path , ( uint8_t * ) sg_dev_type , & sg_dev_type_size , _LINUX_SG_DEV_TYPE_SES_LEN + 1 ) ; if ( ( tmp_rc != 0 ) && ( tmp_rc != EFBIG ) ) { free ( sysfs_sg_type_path ) ; continue ; } if ( strncmp ( sg_dev_type , _LINUX_SG_DEV_TYPE_SES , _LINUX_SG_DEV_TYPE_SES_LEN ) == 0 ) { if ( lsm_string_list_append ( sg_name_list , sg_name ) != 0 ) { free ( sysfs_sg_type_path ) ; _lsm_err_msg_set ( err_msg , "No<S2SV_blank>memory" ) ; rc = LSM_ERR_NO_MEMORY ; goto out ; } } free ( sysfs_sg_type_path ) ; } } while ( dp != NULL ) ; * sg_count = lsm_string_list_size ( sg_name_list ) ; * sg_paths = ( char * * ) malloc ( sizeof ( char * ) * ( * sg_count ) ) ; _alloc_null_check ( err_msg , sg_name_list , rc , out ) ; for ( i = 0 ; i < * sg_count ; ++ i ) ( * sg_paths ) [ i ] = NULL ; _lsm_string_list_foreach ( sg_name_list , i , sg_name ) { ( * sg_paths ) [ i ] = ( char * ) malloc ( sizeof ( char ) * ( strlen ( sg_name ) + strlen ( "/dev/" ) + 1 ) ) ; if ( ( * sg_paths ) [ i ] == NULL ) { rc = LSM_ERR_NO_MEMORY ; goto out ; } sprintf ( ( * sg_paths ) [ i ] , "/dev/%s" , sg_name ) ; } out : if ( dir != NULL ) closedir ( dir ) ; if ( sg_name_list != NULL ) lsm_string_list_free ( sg_name_list ) ; if ( rc != LSM_ERR_OK ) { if ( * sg_paths != NULL ) { for ( i = 0 ; i < * sg_count ; ++ i ) free ( ( char * ) ( * sg_paths ) [ i ] ) ; free ( * sg_paths ) ; } * sg_paths = NULL ; * sg_count = 0 ; } return rc ; } | <S2SV_ModStart> ) * ( strlen <S2SV_ModEnd> ( _SYSFS_SG_ROOT_PATH ) <S2SV_ModStart> "/" ) + strlen <S2SV_ModEnd> ( sg_name ) |
4,624 | CWE-000 static void arm_memio_stm ( arm_memio_t op ) { <S2SV_StartBug> arm_memio_mult ( op , ARM_MEMIO_STORE ) ; <S2SV_EndBug> } | <S2SV_ModStart> op ) { bool first = true ; uint8_t i ; for ( i = 0 ; i < 16 ; i ++ ) { if ( op . regs & ( 1 << i ) ) { arm_write_s ( op . addr , arm_r . r [ i ] ) ; if ( first ) { arm_r . r [ op . rn ] += op . disp ; first = false ; } op . addr += 4 ; } } <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
4,625 | CWE-000 static void btree_xlog_insert ( bool isleaf , bool ismeta , XLogReaderState * record ) { XLogRecPtr lsn = record -> EndRecPtr ; xl_btree_insert * xlrec = ( xl_btree_insert * ) XLogRecGetData ( record ) ; Buffer buffer , ulogbuf = InvalidBuffer ; Page page ; if ( ! isleaf ) _bt_clear_incomplete_split ( record , 1 ) ; else if ( XLogReadBufferForRedo ( record , 1 , & ulogbuf ) == BLK_NEEDS_REDO ) { ul_btree_insert ulrec ; ul_item_xact ulxact ; ULogRecPtr uba ; BlockNumber blkno ; Size datalen ; char * data ; XLogRecGetBlockTag ( record , 0 , NULL , NULL , & blkno ) ; ulrec . flags = xlrec -> flags & ULH_COMMON_FLAGS_MASK ; data = ( ( char * ) xlrec ) + SizeOfBtreeInsert ; if ( ItemXactAlreadyExist ( ulrec . flags ) ) memcpy ( ( char * ) & ulxact , data , sizeof ( ULogRecPtr ) ) ; else if ( ItemXactReuseFromOldXact ( ulrec . flags ) ) memcpy ( ( char * ) & ulxact , data , SizeOfULogItemXact ) ; data = XLogRecGetBlockData ( record , 0 , & datalen ) ; ULogBeginInsert ( ulogbuf ) ; ulrec . target . relid = xlrec -> relid ; ulrec . target . blknum = blkno ; ULogRegisterData ( ( char * ) & ulrec , SizeOfULogBtreeInsert ) ; if ( ItemXactAlreadyExist ( ulrec . flags ) ) ULogRegisterData ( ( char * ) & ulxact , sizeof ( ULogRecPtr ) ) ; else if ( ItemXactReuseFromOldXact ( ulrec . flags ) ) ULogRegisterData ( ( char * ) & ulxact , SizeOfULogItemXact ) ; ULogRegisterData ( data , datalen ) ; uba = ULogInsert ( RM_BTREE_ID , ULOG_BTREE_INSERT_LEAF ) ; <S2SV_StartBug> Assert ( uba == xlrec -> uba ) ; <S2SV_EndBug> PageSetLSN ( BufferGetPage ( ulogbuf ) , lsn ) ; MarkBufferDirty ( ulogbuf ) ; } if ( BufferIsValid ( ulogbuf ) ) UnlockReleaseBuffer ( ulogbuf ) ; if ( XLogReadBufferForRedo ( record , 0 , & buffer ) == BLK_NEEDS_REDO ) { Size datalen ; char * datapos = XLogRecGetBlockData ( record , 0 , & datalen ) ; IndexTupleHeaderData xlhdr ; ItemXact xact ; OffsetNumber xactnum ; page = BufferGetPage ( buffer ) ; memcpy ( ( char * ) & xlhdr , datapos , SizeofIndexTupleHeader ) ; xactnum = xlhdr . t_lock ; xact = PageAllocXact ( page , xactnum , XLogRecGetXid ( record ) ) ; ItemXactSetUBA ( xact , xlrec -> uba ) ; ItemXactIncrNlocks ( xact ) ; if ( PageAddItem ( page , ( Item ) datapos , datalen , xlrec -> offnum , false , false ) == InvalidOffsetNumber ) elog ( PANIC , "btree_insert_redo:<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>add<S2SV_blank>item" ) ; PageSetLSN ( page , lsn ) ; MarkBufferDirty ( buffer ) ; } if ( BufferIsValid ( buffer ) ) UnlockReleaseBuffer ( buffer ) ; if ( ismeta ) _bt_restore_meta ( record , 2 ) ; } | <S2SV_ModStart> ; Assert ( ULogRecPtrEquals ( uba , <S2SV_ModEnd> xlrec -> uba <S2SV_ModStart> -> uba ) ) |
4,626 | CWE-000 static void bbr_init ( struct sock * sk ) { struct tcp_sock * tp = tcp_sk ( sk ) ; struct bbr * bbr = inet_csk_ca ( sk ) ; bbr -> prior_cwnd = 0 ; tp -> snd_ssthresh = TCP_INFINITE_SSTHRESH ; bbr -> rtt_cnt = 0 ; bbr -> next_rtt_delivered = 0 ; bbr -> prev_ca_state = TCP_CA_Open ; bbr -> packet_conservation = 0 ; bbr -> probe_rtt_done_stamp = 0 ; bbr -> probe_rtt_round_done = 0 ; bbr -> min_rtt_us = tcp_min_rtt ( tp ) ; bbr -> min_rtt_stamp = tcp_jiffies32 ; minmax_reset ( & bbr -> bw , bbr -> rtt_cnt , 0 ) ; bbr -> has_seen_rtt = 0 ; bbr_init_pacing_rate_from_rtt ( sk ) ; <S2SV_StartBug> bbr -> restore_cwnd = 0 ; <S2SV_EndBug> bbr -> round_start = 0 ; bbr -> idle_restart = 0 ; bbr -> full_bw_reached = 0 ; bbr -> full_bw = 0 ; bbr -> full_bw_cnt = 0 ; bbr -> cycle_mstamp = 0 ; bbr -> cycle_idx = 0 ; bbr_reset_lt_bw_sampling ( sk ) ; bbr_reset_startup_mode ( sk ) ; cmpxchg ( & sk -> sk_pacing_status , SK_PACING_NONE , SK_PACING_NEEDED ) ; } | <S2SV_ModStart> ; bbr -> <S2SV_ModEnd> round_start = 0 |
4,627 | CWE-000 <S2SV_StartBug> void omsu_free_osu_data ( omsi_t * omsi_data , <S2SV_EndBug> const omsi_callback_free_memory freeMemory ) { omsi_unsigned_int i , j = 0 ; omsi_unsigned_int size ; real_var_attribute_t * attribute ; freeMemory ( ( omsi_string ) omsi_data -> model_data -> modelGUID ) ; size = omsi_data -> model_data -> n_states + omsi_data -> model_data -> n_derivatives + omsi_data -> model_data -> n_real_vars + omsi_data -> model_data -> n_real_parameters + omsi_data -> model_data -> n_real_aliases ; for ( i = 0 ; i < size ; i ++ , j ++ ) { <S2SV_StartBug> freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . name ) ; <S2SV_EndBug> freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . comment ) ; attribute = omsi_data -> model_data -> model_vars_info_t [ j ] . modelica_attributes ; freeMemory ( attribute -> unit ) ; freeMemory ( attribute -> displayUnit ) ; freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . modelica_attributes ) ; } size += omsi_data -> model_data -> n_int_vars + omsi_data -> model_data -> n_int_parameters + omsi_data -> model_data -> n_int_aliases + omsi_data -> model_data -> n_bool_vars + omsi_data -> model_data -> n_bool_parameters + omsi_data -> model_data -> n_bool_aliases + omsi_data -> model_data -> n_string_vars + omsi_data -> model_data -> n_string_parameters + omsi_data -> model_data -> n_string_aliases ; for ( i = j ; i < size ; i ++ , j ++ ) { freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . name ) ; freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . comment ) ; freeMemory ( omsi_data -> model_data -> model_vars_info_t [ j ] . modelica_attributes ) ; } freeMemory ( omsi_data -> model_data -> model_vars_info_t ) ; <S2SV_StartBug> freeMemory ( omsi_data -> sim_data -> initialization ) ; <S2SV_EndBug> freeMemory ( omsi_data -> sim_data -> simulation ) ; freeMemory ( omsi_data -> sim_data -> model_vars_and_params -> reals ) ; freeMemory ( omsi_data -> sim_data -> model_vars_and_params -> ints ) ; freeMemory ( omsi_data -> sim_data -> model_vars_and_params -> bools ) ; freeMemory ( omsi_data -> sim_data -> zerocrossings_vars ) ; freeMemory ( omsi_data -> sim_data -> pre_zerocrossings_vars ) ; freeMemory ( ( omsi_char * ) omsi_data -> experiment -> solver_name ) ; <S2SV_StartBug> freeMemory ( omsi_data -> experiment ) ; <S2SV_EndBug> } | <S2SV_ModStart> omsi_t * omsi_data ) { omsu_free_model_data <S2SV_ModEnd> ( omsi_data -> <S2SV_ModStart> omsi_data -> model_data ) ; omsu_free_sim_data <S2SV_ModEnd> ( omsi_data -> <S2SV_ModStart> omsi_data -> sim_data ) ; global_callback -> <S2SV_ModEnd> freeMemory ( ( <S2SV_ModStart> solver_name ) ; global_callback -> |
4,628 | CWE-000 <S2SV_StartBug> static int stripe_status ( struct dm_target * ti , <S2SV_EndBug> status_type_t type , char * result , unsigned int maxlen ) { struct stripe_c * sc = ( struct stripe_c * ) ti -> private ; char buffer [ sc -> stripes + 1 ] ; unsigned int sz = 0 ; unsigned int i ; switch ( type ) { case STATUSTYPE_INFO : DMEMIT ( "%d<S2SV_blank>" , sc -> stripes ) ; for ( i = 0 ; i < sc -> stripes ; i ++ ) { DMEMIT ( "%s<S2SV_blank>" , sc -> stripe [ i ] . dev -> name ) ; buffer [ i ] = atomic_read ( & ( sc -> stripe [ i ] . error_count ) ) ? 'D' : 'A' ; } buffer [ i ] = '\\0' ; DMEMIT ( "1<S2SV_blank>%s" , buffer ) ; break ; case STATUSTYPE_TABLE : DMEMIT ( "%d<S2SV_blank>%llu" , sc -> stripes , ( unsigned long long ) sc -> chunk_mask + 1 ) ; for ( i = 0 ; i < sc -> stripes ; i ++ ) DMEMIT ( "<S2SV_blank>%s<S2SV_blank>%llu" , sc -> stripe [ i ] . dev -> name , ( unsigned long long ) sc -> stripe [ i ] . physical_start ) ; break ; } <S2SV_StartBug> return 0 ; <S2SV_EndBug> } | <S2SV_ModStart> <S2SV_null> <S2SV_null> static void <S2SV_ModEnd> stripe_status ( struct <S2SV_ModStart> break ; } <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
4,629 | CWE-000 int mpu_memory_write ( struct inv_mpu_state * st , u8 mpu_addr , u16 mem_addr , u32 len , u8 const * data ) { u8 bank [ 2 ] ; u8 addr [ 2 ] ; u8 buf [ 513 ] ; struct i2c_msg msgs [ 3 ] ; int res ; if ( ! data || ! st ) return - EINVAL ; if ( len >= ( sizeof ( buf ) - 1 ) ) return - ENOMEM ; bank [ 0 ] = REG_BANK_SEL ; bank [ 1 ] = mem_addr >> 8 ; addr [ 0 ] = REG_MEM_START_ADDR ; addr [ 1 ] = mem_addr & 0xFF ; buf [ 0 ] = REG_MEM_RW ; memcpy ( buf + 1 , data , len ) ; msgs [ 0 ] . addr = mpu_addr ; msgs [ 0 ] . flags = 0 ; msgs [ 0 ] . buf = bank ; msgs [ 0 ] . len = sizeof ( bank ) ; msgs [ 1 ] . addr = mpu_addr ; msgs [ 1 ] . flags = 0 ; msgs [ 1 ] . buf = addr ; msgs [ 1 ] . len = sizeof ( addr ) ; msgs [ 2 ] . addr = mpu_addr ; msgs [ 2 ] . flags = 0 ; msgs [ 2 ] . buf = ( u8 * ) buf ; msgs [ 2 ] . len = len + 1 ; INV_I2C_INC_MPUWRITE ( 3 + 3 + ( 2 + len ) ) ; <S2SV_StartBug> # if CONFIG_DYNAMIC_DEBUG <S2SV_EndBug> { char * write = 0 ; pr_debug ( "%s<S2SV_blank>WM%02X%02X%02X%s%s<S2SV_blank>-<S2SV_blank>%d\\n" , st -> hw -> name , mpu_addr , bank [ 1 ] , addr [ 1 ] , wr_pr_debug_begin ( data , len , write ) , wr_pr_debug_end ( write ) , len ) ; } # endif res = i2c_transfer ( st -> sl_handle , msgs , 3 ) ; if ( res != 3 ) { if ( res >= 0 ) res = - EIO ; return res ; } else { return 0 ; } } | <S2SV_ModStart> ) ; # ifdef <S2SV_ModEnd> CONFIG_DYNAMIC_DEBUG { char |
4,630 | CWE-000 void playWeek ( int n , player_t * players , int size , team_t * teams ) { game_t * games ; int m = getGames ( & games ) ; game_t gameShouldPlay [ 8 ] ; int k = 0 ; for ( int i = 0 ; i < m ; i ++ ) { if ( games [ i ] . week == n ) { gameShouldPlay [ k ] . id = games [ i ] . id ; gameShouldPlay [ k ] . team1id = games [ i ] . team1id ; gameShouldPlay [ k ] . team2id = games [ i ] . team2id ; k ++ ; } } for ( int i = 0 ; i < 8 ; i ++ ) if ( teams [ gameShouldPlay [ i ] . team1id - 1 ] . isPlayer == 0 && teams [ gameShouldPlay [ i ] . team2id - 1 ] . isPlayer == 0 ) { int goalTeam1 = 0 ; int goalTeam2 = 0 ; bubblePlayers ( players , size , playerTEAMID ) ; int size1 = 0 ; int size2 = 0 ; int team1Last = 0 ; int team2Last = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( players [ i ] . teamid == gameShouldPlay [ i ] . team1id ) { size1 ++ ; team1Last = i ; } else if ( players [ i ] . teamid == gameShouldPlay [ i ] . team2id ) { size2 ++ ; team2Last = i ; } } <S2SV_StartBug> playGameCC ( teams [ gameShouldPlay [ i ] . team1id - 1 ] , teams [ gameShouldPlay [ i ] . team2id - 1 ] , & goalTeam1 , & goalTeam2 , & players [ team1Last - size1 - 1 ] , size1 , & players [ team2Last - size2 - 1 ] , size2 ) ; <S2SV_EndBug> natayej_t natije ; natije . gameid = gameShouldPlay [ i ] . id ; natije . team1goal = goalTeam1 ; natije . team2goal = goalTeam2 ; addNatayejProfile ( & natije , 1 ) ; } } | <S2SV_ModStart> } playGameCC ( & <S2SV_ModStart> 1 ] , & |
4,631 | CWE-000 static void test_hci_timeout ( void * * state ) { HCIAction action [ 1 ] ; <S2SV_StartBug> hci_override_now ( manager , 0.0 ) ; <S2SV_EndBug> hci_init ( manager , prefix , 10.0 , 1.0 ) ; <S2SV_StartBug> hci_override_now ( manager , 4.0 ) ; <S2SV_EndBug> hci_query ( manager , action ) ; assert_true ( manager -> LongestTimeBetweenQueries == 4.0 ) ; hci_override_now ( manager , 8.5 ) ; hci_query ( manager , action ) ; assert_int_equal ( action -> type , HCI_TIMEOUT ) ; assert_int_equal ( action -> write_snapshot , 1 ) ; } | <S2SV_ModStart> ( manager , 1.0 <S2SV_ModEnd> ) ; hci_init <S2SV_ModStart> ( manager , 5.0 <S2SV_ModEnd> ) ; hci_query |
4,632 | CWE-000 <S2SV_StartBug> const char * gear_token_as_string ( const enum TokenType token_type ) <S2SV_EndBug> { switch ( token_type ) { case GEAR_TOKEN_LCURLYB : return "{" ; case GEAR_TOKEN_RCURLYB : return "}" ; case GEAR_TOKEN_LBRACE : return "[" ; case GEAR_TOKEN_RBRACE : return "]" ; case GEAR_TOKEN_LPAREN : return "(" ; case GEAR_TOKEN_RPAREN : return ")" ; case GEAR_TOKEN_DOT : return "." ; case GEAR_TOKEN_COLON : return ":" ; case GEAR_TOKEN_COMMA : return "," ; case GEAR_TOKEN_ASSIGN : return "=" ; case GEAR_TOKEN_NEW_SLOT : return ":=" ; case GEAR_TOKEN_FN_RET : return "->" ; case GEAR_TOKEN_EQ_REF : return "===" ; case GEAR_TOKEN_NEQ_REF : return "!==" ; case GEAR_TOKEN_CMP : return "<=>" ; case GEAR_TOKEN_EQ : return "==" ; case GEAR_TOKEN_NEQ : return "!=" ; case GEAR_TOKEN_GT : return ">" ; case GEAR_TOKEN_LT : return "<" ; case GEAR_TOKEN_GTEQ : return ">=" ; case GEAR_TOKEN_LTEQ : return "<=" ; case GEAR_TOKEN_ADD : return "+" ; case GEAR_TOKEN_SUB : return "-" ; case GEAR_TOKEN_MUL : return "*" ; case GEAR_TOKEN_DIV : return "/" ; case GEAR_TOKEN_MOD : return "%" ; case GEAR_TOKEN_AND : return "&&" ; case GEAR_TOKEN_OR : return "||" ; case GEAR_TOKEN_XOR : return "^" ; case GEAR_TOKEN_LAND : return "&" ; case GEAR_TOKEN_LOR : return "|" ; case GEAR_TOKEN_LSHIFT : return "<<" ; case GEAR_TOKEN_RSHIFT : return ">>" ; case GEAR_TOKEN_COMPLEMENT : return "~" ; case GEAR_TOKEN_NOT : return "!" ; case GEAR_TOKEN_IRANGE : return ".." ; case GEAR_TOKEN_XRANGE : return "..." ; case GEAR_TOKEN_IF : return "if" ; case GEAR_TOKEN_ELSE : return "else" ; case GEAR_TOKEN_ELIF : return "elif" ; case GEAR_TOKEN_END : return "end" ; case GEAR_TOKEN_PROTOCOL : return "proto" ; case GEAR_TOKEN_STRUCT : return "struct" ; case GEAR_TOKEN_UNION : return "union" ; case GEAR_TOKEN_FOR : return "for" ; case GEAR_TOKEN_IN : return "in" ; case GEAR_TOKEN_DO : return "do" ; case GEAR_TOKEN_WHILE : return "while" ; case GEAR_TOKEN_SWITCH : return "switch" ; case GEAR_TOKEN_CASE : return "case" ; case GEAR_TOKEN_BREAK : return "break" ; case GEAR_TOKEN_CONTINUE : return "continue" ; case GEAR_TOKEN_TRUE : return "true" ; case GEAR_TOKEN_FALSE : return "false" ; case GEAR_TOKEN_FN : return "fn" ; case GEAR_TOKEN_RET : return "ret" ; case GEAR_TOKEN_YIELD : return "yield" ; case GEAR_TOKEN_TYPEOF : return "typeof" ; case GEAR_TOKEN_MODULE : return "module" ; case GEAR_TOKEN_LET : return "let" ; case GEAR_TOKEN_VAR : return "var" ; case GEAR_TOKEN_INTEGER : return "integer" ; case GEAR_TOKEN_REAL : return "real" ; case GEAR_TOKEN_STRING : return "string" ; case GEAR_TOKEN_NIL : return "nil" ; case GEAR_TOKEN_ID : return "identifier" ; case GEAR_TOKEN_TERM : return "term" ; case GEAR_TOKEN_EOF : return "EOF" ; default : return "?" ; } } | <S2SV_ModStart> gear_token_as_string ( const gear_token_type <S2SV_ModEnd> token_type ) { |
4,633 | CWE-000 static PyObject * PyPhotonClient_reconstruct_object ( PyObject * self , PyObject * args ) { object_id object_id ; <S2SV_StartBug> if ( ! PyArg_ParseTuple ( args , "O&" , & PyObjectToUniqueID , & object_id ) ) { <S2SV_EndBug> return NULL ; } photon_reconstruct_object ( ( ( PyPhotonClient * ) self ) -> photon_connection , object_id ) ; Py_RETURN_NONE ; } | <S2SV_ModStart> , "O&" , PyStringToUniqueID <S2SV_ModEnd> , & object_id |
4,634 | CWE-000 int main ( int argc , char * * argv ) { char * path ; int c ; int fd ; int secsize ; uint64_t blksectors = 0 ; struct stat sb ; int verbose = 0 ; uint64_t offset = 0ul ; uint32_t length = DEF_REPORT_LEN ; static const struct option longopts [ ] = { <S2SV_StartBug> { "help" , 0 , 0 , 'h' } , <S2SV_EndBug> { "version" , 0 , 0 , 'V' } , { "zone" , 1 , 0 , 'z' } , { "count" , 1 , 0 , 'c' } , { "verbose" , 0 , 0 , 'v' } , { NULL , 0 , 0 , 0 } } ; setlocale ( LC_ALL , "" ) ; bindtextdomain ( PACKAGE , LOCALEDIR ) ; textdomain ( PACKAGE ) ; atexit ( close_stdout ) ; while ( ( c = getopt_long ( argc , argv , "hc:z:vV" , longopts , NULL ) ) != - 1 ) { switch ( c ) { case 'h' : usage ( stdout ) ; break ; case 'c' : length = strtosize_or_err ( optarg , _ ( "failed<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>number<S2SV_blank>of<S2SV_blank>zones" ) ) ; break ; case 'z' : offset = strtosize_or_err ( optarg , _ ( "failed<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>zone<S2SV_blank>offset" ) ) ; break ; case 'v' : verbose = 1 ; break ; case 'V' : printf ( UTIL_LINUX_VERSION ) ; return EXIT_SUCCESS ; default : usage ( stderr ) ; break ; } } if ( optind == argc ) errx ( EXIT_FAILURE , _ ( "no<S2SV_blank>device<S2SV_blank>specified" ) ) ; path = argv [ optind ++ ] ; if ( optind != argc ) { warnx ( _ ( "unexpected<S2SV_blank>number<S2SV_blank>of<S2SV_blank>arguments" ) ) ; usage ( stderr ) ; } fd = open ( path , O_RDONLY ) ; if ( fd < 0 ) err ( EXIT_FAILURE , _ ( "cannot<S2SV_blank>open<S2SV_blank>%s" ) , path ) ; if ( fstat ( fd , & sb ) == - 1 ) err ( EXIT_FAILURE , _ ( "stat<S2SV_blank>of<S2SV_blank>%s<S2SV_blank>failed" ) , path ) ; if ( ! S_ISBLK ( sb . st_mode ) ) errx ( EXIT_FAILURE , _ ( "%s:<S2SV_blank>not<S2SV_blank>a<S2SV_blank>block<S2SV_blank>device" ) , path ) ; if ( blkdev_get_sectors ( fd , ( unsigned long long * ) & blksectors ) ) err ( EXIT_FAILURE , _ ( "%s:<S2SV_blank>blkdev_get_sectors<S2SV_blank>ioctl<S2SV_blank>failed" ) , path ) ; if ( blkdev_get_sector_size ( fd , & secsize ) ) err ( EXIT_FAILURE , _ ( "%s:<S2SV_blank>BLKSSZGET<S2SV_blank>ioctl<S2SV_blank>failed" ) , path ) ; if ( offset > blksectors ) errx ( EXIT_FAILURE , _ ( "%s:<S2SV_blank>offset<S2SV_blank>is<S2SV_blank>greater<S2SV_blank>than<S2SV_blank>device<S2SV_blank>size" ) , path ) ; if ( length < 1 ) length = 1 ; if ( length > MAX_REPORT_LEN ) { length = MAX_REPORT_LEN ; warnx ( _ ( "limiting<S2SV_blank>report<S2SV_blank>to<S2SV_blank>%u<S2SV_blank>entries" ) , length ) ; } if ( do_report ( fd , offset , length , verbose ) ) err ( EXIT_FAILURE , _ ( "%s:<S2SV_blank>BLKREPORTZONE<S2SV_blank>ioctl<S2SV_blank>failed" ) , path ) ; close ( fd ) ; return EXIT_SUCCESS ; } | <S2SV_ModStart> { "help" , no_argument , NULL , 'h' } , { "version" , no_argument , NULL , 'V' } , { "zone" , required_argument , NULL , 'z' } , { "count" , required_argument , NULL , 'c' } , { "verbose" , no_argument , NULL , 'v' } , { NULL , 0 , NULL <S2SV_ModEnd> , 0 } |
4,635 | CWE-000 void PortE_Init ( ) { volatile unsigned long delay ; SYSCTL_RCGC2_R |= 0x10 ; delay = SYSCTL_RCGC2_R ; GPIO_PORTE_LOCK_R = 0x4C4F434B ; <S2SV_StartBug> GPIO_PORTE_CR_R = 0x1F ; <S2SV_EndBug> GPIO_PORTE_AMSEL_R = 0x00 ; GPIO_PORTE_PCTL_R = 0x00000000 ; <S2SV_StartBug> GPIO_PORTE_DIR_R = 0x0E ; <S2SV_EndBug> GPIO_PORTE_AFSEL_R = 0x00 ; GPIO_PORTE_PUR_R = 0x11 ; <S2SV_StartBug> GPIO_PORTE_DEN_R = 0x1F ; <S2SV_EndBug> } | <S2SV_ModStart> ; GPIO_PORTE_CR_R = 0x5F <S2SV_ModEnd> ; GPIO_PORTE_PCTL_R = <S2SV_ModStart> ; GPIO_PORTE_DIR_R = 0x2E <S2SV_ModEnd> ; GPIO_PORTE_AFSEL_R = <S2SV_ModStart> ; GPIO_PORTE_DEN_R = 0x2F <S2SV_ModEnd> ; } <S2SV_null> |
4,636 | CWE-000 static void <S2SV_StartBug> print_intel_add_smart ( void * buf , uint32_t size __unused ) <S2SV_EndBug> { uint8_t * walker = buf ; uint8_t * end = walker + 150 ; const char * name ; uint64_t raw ; uint8_t normalized ; static struct kv_name kv [ ] = { { 0xab , "Program<S2SV_blank>Fail<S2SV_blank>Count" } , { 0xac , "Erase<S2SV_blank>Fail<S2SV_blank>Count" } , { 0xad , "Wear<S2SV_blank>Leveling<S2SV_blank>Count" } , { 0xb8 , "End<S2SV_blank>to<S2SV_blank>End<S2SV_blank>Error<S2SV_blank>Count" } , { 0xc7 , "CRC<S2SV_blank>Error<S2SV_blank>Count" } , { 0xe2 , "Timed:<S2SV_blank>Media<S2SV_blank>Wear" } , { 0xe3 , "Timed:<S2SV_blank>Host<S2SV_blank>Read<S2SV_blank>%" } , { 0xe4 , "Timed:<S2SV_blank>Elapsed<S2SV_blank>Time" } , { 0xea , "Thermal<S2SV_blank>Throttle<S2SV_blank>Status" } , { 0xf0 , "Retry<S2SV_blank>Buffer<S2SV_blank>Overflows" } , { 0xf3 , "PLL<S2SV_blank>Lock<S2SV_blank>Loss<S2SV_blank>Count" } , { 0xf4 , "NAND<S2SV_blank>Bytes<S2SV_blank>Written" } , { 0xf5 , "Host<S2SV_blank>Bytes<S2SV_blank>Written" } , } ; printf ( "Additional<S2SV_blank>SMART<S2SV_blank>Data<S2SV_blank>Log\\n" ) ; printf ( "=========================\\n" ) ; while ( walker < end ) { name = kv_lookup ( kv , nitems ( kv ) , * walker ) ; normalized = walker [ 3 ] ; raw = le48dec ( walker + 5 ) ; switch ( * walker ) { case 0 : break ; case 0xad : printf ( "%-32s:<S2SV_blank>%3d<S2SV_blank>min:<S2SV_blank>%u<S2SV_blank>max:<S2SV_blank>%u<S2SV_blank>ave:<S2SV_blank>%u\\n" , name , normalized , le16dec ( walker + 5 ) , le16dec ( walker + 7 ) , le16dec ( walker + 9 ) ) ; break ; case 0xe2 : printf ( "%-32s:<S2SV_blank>%3d<S2SV_blank>%.3f%%\\n" , name , normalized , raw / 1024.0 ) ; break ; case 0xea : printf ( "%-32s:<S2SV_blank>%3d<S2SV_blank>%d%%<S2SV_blank>%d<S2SV_blank>times\\n" , name , normalized , walker [ 5 ] , le32dec ( walker + 6 ) ) ; break ; default : printf ( "%-32s:<S2SV_blank>%3d<S2SV_blank>%ju\\n" , name , normalized , ( uintmax_t ) raw ) ; break ; } walker += 12 ; } } | <S2SV_ModStart> void print_intel_add_smart ( const struct nvme_controller_data * cdata __unused , |
4,637 | CWE-000 int lua_git_branch_upstream ( lua_State * L ) { luagit2_reference * lua_ref ; const luagit2_reference * lua_branch_base = ( luagit2_reference * ) lua_touserdata ( L , 1 ) ; lua_ref = ( luagit2_reference * ) lua_newuserdata ( L , sizeof ( * lua_ref ) ) ; lua_ref -> reference = NULL ; luaL_newmetatable ( L , "luagit2_reference" ) ; lua_setmetatable ( L , - 2 ) ; git_reference * local_ref ; check_error_long ( git_branch_upstream ( & local_ref , lua_branch_base -> reference ) , "Error<S2SV_blank>in<S2SV_blank>getting<S2SV_blank>branch<S2SV_blank>upstream" , NULL ) ; lua_ref -> reference = local_ref ; <S2SV_StartBug> git_reference_free ( local_ref ) ; <S2SV_EndBug> return 1 ; } | <S2SV_ModStart> = local_ref ; <S2SV_ModEnd> return 1 ; |
4,638 | CWE-000 void debugPrintMemoryStack ( ) { <S2SV_StartBug> printMemoryListStack ( & gMemoryHandler . mMemoryStack ) ; <S2SV_EndBug> } | <S2SV_ModStart> ( ) { logError ( "Unimplemented." ) ; abortSystem ( <S2SV_ModEnd> ) ; } |
4,639 | CWE-000 void __watcher_handle_event ( struct inotify_event * event ) { pthread_mutex_lock ( & __event_handling_mutex ) ; __is_event_processing = 1 ; char path [ FILE_PATH_LENGTH ] ; if ( event -> len ) { if ( event -> name [ 0 ] != '.' ) { if ( event -> mask & IN_MODIFY ) { if ( ! ( event -> mask & IN_ISDIR ) ) { log_debug ( "sync" , "\'%s\'<S2SV_blank>modified" , event -> name ) ; file_path ( __watched_dir_path , event -> name , path , FILE_PATH_LENGTH ) ; comm_upload ( path ) ; } } <S2SV_StartBug> else if ( event -> mask & IN_CREATE ) <S2SV_EndBug> { if ( ! ( event -> mask & IN_ISDIR ) ) { log_debug ( "sync" , "\'%s\'<S2SV_blank>created" , event -> name ) ; file_path ( __watched_dir_path , event -> name , path , FILE_PATH_LENGTH ) ; comm_upload ( path ) ; } } else if ( event -> mask & IN_MOVED_TO ) { if ( ! ( event -> mask & IN_ISDIR ) ) { log_debug ( "sync" , "\'%s\'<S2SV_blank>moved<S2SV_blank>into" , event -> name ) ; file_path ( __watched_dir_path , event -> name , path , FILE_PATH_LENGTH ) ; comm_upload ( path ) ; } } else if ( event -> mask & IN_DELETE ) { if ( ! ( event -> mask & IN_ISDIR ) ) { log_debug ( "sync" , "\'%s\'<S2SV_blank>deleted" , event -> name ) ; comm_delete ( event -> name ) ; } } else if ( event -> mask & IN_MOVED_FROM ) { if ( ! ( event -> mask & IN_ISDIR ) ) { log_debug ( "sync" , "\'%s\'<S2SV_blank>moved<S2SV_blank>from" , event -> name ) ; comm_delete ( event -> name ) ; } } } } __is_event_processing = 0 ; pthread_cond_signal ( & __events_done_processing ) ; pthread_mutex_unlock ( & __event_handling_mutex ) ; } | <S2SV_ModStart> -> mask & <S2SV_ModEnd> IN_MOVED_TO ) { |
4,640 | CWE-000 continent_t * free_all_continents ( continent_t * continents , uint nb_continents ) { <S2SV_StartBug> for ( uint i = nb_continents ; i > 0 ; i -- ) { <S2SV_EndBug> free_continent ( & continents [ i ] ) ; } return NULL ; } | <S2SV_ModStart> uint i = 0 ; i < <S2SV_ModStart> nb_continents ; i ++ ) { fprintf ( stderr , "Free<S2SV_blank>-><S2SV_blank>%s<S2SV_blank>\\n" , continents [ i ] . name ) ; <S2SV_ModEnd> free_continent ( & |
4,641 | CWE-000 void visit_type_sizeList ( Visitor * v , const char * name , sizeList * * obj , Error * * errp ) { Error * err = NULL ; sizeList * tail ; size_t size = sizeof ( * * obj ) ; visit_start_list ( v , name , ( GenericList * * ) obj , size , & err ) ; if ( err ) { goto out ; } for ( tail = * obj ; tail ; tail = ( sizeList * ) visit_next_list ( v , ( GenericList * ) tail , size ) ) { visit_type_size ( v , NULL , & tail -> value , & err ) ; if ( err ) { break ; } } error_propagate ( errp , err ) ; err = NULL ; visit_end_list ( v ) ; <S2SV_StartBug> out : <S2SV_EndBug> error_propagate ( errp , err ) ; } | <S2SV_ModStart> v ) ; if ( err && visit_is_input ( v ) ) { qapi_free_sizeList ( * obj ) ; * obj = NULL ; } |
4,642 | CWE-000 int usbnet_stop ( struct net_device * net ) { struct usbnet * dev = netdev_priv ( net ) ; struct driver_info * info = dev -> driver_info ; <S2SV_StartBug> int retval ; <S2SV_EndBug> clear_bit ( EVENT_DEV_OPEN , & dev -> flags ) ; netif_stop_queue ( net ) ; netif_info ( dev , ifdown , dev -> net , "stop<S2SV_blank>stats:<S2SV_blank>rx/tx<S2SV_blank>%lu/%lu,<S2SV_blank>errs<S2SV_blank>%lu/%lu\\n" , net -> stats . rx_packets , net -> stats . tx_packets , net -> stats . rx_errors , net -> stats . tx_errors ) ; <S2SV_StartBug> if ( info -> stop ) { <S2SV_EndBug> retval = info -> stop ( dev ) ; if ( retval < 0 ) netif_info ( dev , ifdown , dev -> net , "stop<S2SV_blank>fail<S2SV_blank>(%d)<S2SV_blank>usbnet<S2SV_blank>usb-%s-%s,<S2SV_blank>%s\\n" , retval , dev -> udev -> bus -> bus_name , dev -> udev -> devpath , info -> description ) ; } if ( ! ( info -> flags & FLAG_AVOID_UNLINK_URBS ) ) usbnet_terminate_urbs ( dev ) ; usbnet_status_stop ( dev ) ; usbnet_purge_paused_rxq ( dev ) ; dev -> flags = 0 ; del_timer_sync ( & dev -> delay ) ; <S2SV_StartBug> cancel_work_sync ( & dev -> bh_w ) ; <S2SV_EndBug> if ( info -> manage_power && ! test_and_clear_bit ( EVENT_NO_RUNTIME_PM , & dev -> flags ) ) info -> manage_power ( dev , 0 ) ; else usb_autopm_put_interface ( dev -> intf ) ; return 0 ; } | <S2SV_ModStart> ; int retval , pm <S2SV_ModStart> tx_errors ) ; pm = usb_autopm_get_interface ( dev -> intf ) ; <S2SV_ModStart> dev -> bh_w ) ; if ( ! pm ) usb_autopm_put_interface ( dev -> intf |
4,643 | CWE-000 BijiInfoSet * <S2SV_StartBug> biji_info_set_new ( ) <S2SV_EndBug> { BijiInfoSet * retval ; retval = g_slice_new0 ( BijiInfoSet ) ; retval -> url = NULL ; retval -> title = NULL ; retval -> content = NULL ; retval -> datasource_urn = NULL ; retval -> tracker_urn = NULL ; retval -> user_data = NULL ; return retval ; } | <S2SV_ModStart> * biji_info_set_new ( void |
4,644 | CWE-000 static void khttpd_file_location_get ( struct khttpd_location * location , struct khttpd_mbuf_json * output ) { char buf [ 64 ] ; struct sbuf sbuf ; struct khttpd_file_location_data * location_data ; KHTTPD_ENTRY ( "khttpd_file_location_get(%p)" , location ) ; mtx_lock ( & khttpd_file_lock ) ; KHTTPD_ENTRY ( "khttpd_file_location_dtor(%p)" , location ) ; location_data = khttpd_location_data ( location ) ; mtx_unlock ( & khttpd_file_lock ) ; khttpd_mbuf_json_object_begin ( output ) ; sbuf_new ( & sbuf , buf , sizeof ( buf ) , SBUF_AUTOEXTEND ) ; if ( location_data -> charset_rewriter != NULL ) { khttpd_obj_type_get_id ( & khttpd_ctrl_rewriters , location_data -> charset_rewriter , & sbuf ) ; sbuf_finish ( & sbuf ) ; khttpd_mbuf_json_property ( output , "charsetRules" ) ; khttpd_mbuf_json_cstr ( output , TRUE , sbuf_data ( & sbuf ) ) ; } if ( location_data -> mime_type_rewriter != NULL ) { sbuf_clear ( & sbuf ) ; khttpd_obj_type_get_id ( & khttpd_ctrl_rewriters , location_data -> mime_type_rewriter , & sbuf ) ; sbuf_finish ( & sbuf ) ; khttpd_mbuf_json_property ( output , "mimeTypeRules" ) ; khttpd_mbuf_json_cstr ( output , TRUE , sbuf_data ( & sbuf ) ) ; } <S2SV_StartBug> khttpd_mbuf_json_property ( output , "documentRoot" ) ; <S2SV_EndBug> khttpd_mbuf_json_cstr ( output , TRUE , location_data -> docroot ) ; khttpd_mbuf_json_object_end ( output ) ; sbuf_delete ( & sbuf ) ; } | <S2SV_ModStart> ( output , "fsPath" <S2SV_ModEnd> ) ; khttpd_mbuf_json_cstr |
4,645 | CWE-000 static bool maybe_suggest_missing_std_header ( location_t location , tree name ) { gcc_assert ( TREE_CODE ( name ) == IDENTIFIER_NODE ) ; const char * name_str = IDENTIFIER_POINTER ( name ) ; <S2SV_StartBug> const char * header_hint = get_std_name_hint ( name_str ) ; <S2SV_EndBug> if ( ! header_hint ) return false ; gcc_rich_location richloc ( location ) ; <S2SV_StartBug> maybe_add_include_fixit ( & richloc , header_hint ) ; <S2SV_EndBug> inform ( & richloc , "%<std::%s%><S2SV_blank>is<S2SV_blank>defined<S2SV_blank>in<S2SV_blank>header<S2SV_blank>%qs;" "<S2SV_blank>did<S2SV_blank>you<S2SV_blank>forget<S2SV_blank>to<S2SV_blank>%<#include<S2SV_blank>%s%>?" , <S2SV_StartBug> name_str , header_hint , header_hint ) ; <S2SV_EndBug> return true ; } | <S2SV_ModStart> ) ; const std_name_hint <S2SV_ModEnd> * header_hint = <S2SV_ModStart> location ) ; if ( cxx_dialect >= header_hint -> min_dialect ) { const char * header = header_hint -> header ; <S2SV_ModStart> & richloc , header <S2SV_ModEnd> ) ; inform <S2SV_ModStart> , name_str , header , header ) ; } else { inform ( & richloc , "%<std::%s%><S2SV_blank>is<S2SV_blank>only<S2SV_blank>available<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>onwards" , name_str , get_cxx_dialect_name ( header_hint -> min_dialect ) ) ; } <S2SV_ModEnd> return true ; |
4,646 | CWE-000 void CL_ParseBinding ( int key , qboolean down , unsigned time ) { char buf [ MAX_STRING_CHARS ] , * p = buf , * end ; qboolean allCommands , allowUpCmds ; if ( ( clc . state == CA_DISCONNECTED || * clc . downloadName ) && Key_GetCatcher ( ) == 0 ) return ; if ( ! keys [ key ] . binding || ! keys [ key ] . binding [ 0 ] ) return ; Q_strncpyz ( buf , keys [ key ] . binding , sizeof ( buf ) ) ; <S2SV_StartBug> allCommands = ( Key_GetCatcher ( ) == 0 ) ; <S2SV_EndBug> allowUpCmds = ( clc . state != CA_DISCONNECTED ) ; while ( 1 ) { while ( isspace ( * p ) ) p ++ ; end = strchr ( p , ';' ) ; if ( end ) * end = '\\0' ; if ( * p == '+' ) { if ( allCommands || ( allowUpCmds && ! down ) ) { char cmd [ 1024 ] ; Com_sprintf ( cmd , sizeof ( cmd ) , "%c%s<S2SV_blank>%d<S2SV_blank>%d\\n" , ( down ) ? '+' : '-' , p + 1 , key , time ) ; Cbuf_AddText ( cmd ) ; } } else if ( down ) { if ( allCommands || CL_BindUICommand ( p ) ) { Cbuf_AddText ( p ) ; Cbuf_AddText ( "\\n" ) ; } } if ( ! end ) break ; p = end + 1 ; } } | <S2SV_ModStart> allCommands = ( ( Key_GetCatcher ( ) & ~ KEYCATCH_RADIO <S2SV_ModEnd> ) == 0 |
4,647 | CWE-000 void bus_selinux_deinit_global ( void ) { if ( ! is_selinux_enabled ( ) ) return ; <S2SV_StartBug> avc_destroy ( ) ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> ) return ; if ( bus_selinux_avc_open ) { <S2SV_ModStart> ( ) ; bus_selinux_avc_open = false ; } |
4,648 | CWE-000 static int dev_close ( struct sr_dev_inst * sdi ) { struct dev_context * devc ; struct sr_usb_dev_inst * usb ; int ret ; devc = sdi -> priv ; usb = sdi -> conn ; if ( devc -> acquisition ) { sr_err ( "Cannot<S2SV_blank>close<S2SV_blank>device<S2SV_blank>during<S2SV_blank>acquisition!" ) ; devc -> cancel_requested = TRUE ; return SR_ERR_BUG ; } ret = ( * devc -> model -> apply_fpga_config ) ( sdi ) ; if ( ret != SR_OK ) sr_warn ( "Unable<S2SV_blank>to<S2SV_blank>shut<S2SV_blank>down<S2SV_blank>device." ) ; <S2SV_StartBug> libusb_release_interface ( usb -> devhdl , USB_INTERFACE ) ; <S2SV_EndBug> sr_usb_close ( usb ) ; return SR_OK ; } | <S2SV_ModStart> "Unable<S2SV_blank>to<S2SV_blank>shut<S2SV_blank>down<S2SV_blank>device." ) ; if ( usb -> devhdl ) |
4,649 | CWE-000 NodeValues closenessCentrality ( Graph g ) { NodeValues * centrality = newCentralityStruct ( g -> nV ) ; double closeness = 0 ; int reach = 0 ; int dsum = 0 ; int i = 0 ; ShortestPaths * paths ; <S2SV_StartBug> for ( int v = 0 ; v < g -> nV ; v ++ ; ) { <S2SV_EndBug> reach = numReach ( g , v ) ; paths = & pathsdijkstra ( g , v ) ; dsum = 0 ; <S2SV_StartBug> for ( i = 0 ; i < g -> nV ; i ++ ; ) { <S2SV_EndBug> dsum += paths -> dist [ i ] ; } closeness = ( double ) ( reach - 1 ) * ( reach - 1 ) / ( ( g -> nV - 1 ) * dsum ) ; centrality -> values [ v ] = closeness ; } return * centrality ; } | <S2SV_ModStart> ; v ++ <S2SV_ModEnd> ) { reach <S2SV_ModStart> ; i ++ <S2SV_ModEnd> ) { dsum |
4,650 | CWE-000 static VALUE <S2SV_StartBug> rb_file_join ( VALUE ary , VALUE sep ) <S2SV_EndBug> { long len , i ; VALUE result , tmp ; const char * name , * tail ; int checked = TRUE ; rb_encoding * enc ; if ( RARRAY_LEN ( ary ) == 0 ) return rb_str_new ( 0 , 0 ) ; len = 1 ; for ( i = 0 ; i < RARRAY_LEN ( ary ) ; i ++ ) { tmp = RARRAY_AREF ( ary , i ) ; if ( RB_TYPE_P ( tmp , T_STRING ) ) { check_path_encoding ( tmp ) ; len += RSTRING_LEN ( tmp ) ; } else { len += 10 ; } } <S2SV_StartBug> if ( ! NIL_P ( sep ) ) { <S2SV_EndBug> StringValue ( sep ) ; <S2SV_StartBug> len += RSTRING_LEN ( sep ) * ( RARRAY_LEN ( ary ) - 1 ) ; <S2SV_EndBug> } result = rb_str_buf_new ( len ) ; RBASIC_CLEAR_CLASS ( result ) ; OBJ_INFECT ( result , ary ) ; for ( i = 0 ; i < RARRAY_LEN ( ary ) ; i ++ ) { tmp = RARRAY_AREF ( ary , i ) ; switch ( OBJ_BUILTIN_TYPE ( tmp ) ) { case T_STRING : if ( ! checked ) check_path_encoding ( tmp ) ; StringValueCStr ( tmp ) ; break ; case T_ARRAY : if ( ary == tmp ) { rb_raise ( rb_eArgError , "recursive<S2SV_blank>array" ) ; } else { <S2SV_StartBug> VALUE args [ 2 ] ; <S2SV_EndBug> args [ 0 ] = tmp ; args [ 1 ] = sep ; <S2SV_StartBug> tmp = rb_exec_recursive ( file_inspect_join , ary , ( VALUE ) args ) ; <S2SV_EndBug> } break ; default : FilePathStringValue ( tmp ) ; checked = FALSE ; } RSTRING_GETMEM ( result , name , len ) ; if ( i == 0 ) { rb_enc_copy ( result , tmp ) ; } <S2SV_StartBug> else if ( ! NIL_P ( sep ) ) { <S2SV_EndBug> tail = chompdirsep ( name , name + len , rb_enc_get ( result ) ) ; if ( RSTRING_PTR ( tmp ) && isdirsep ( RSTRING_PTR ( tmp ) [ 0 ] ) ) { rb_str_set_len ( result , tail - name ) ; } else if ( ! * tail ) { <S2SV_StartBug> enc = rb_enc_check ( result , sep ) ; <S2SV_EndBug> <S2SV_StartBug> rb_str_buf_append ( result , sep ) ; <S2SV_EndBug> rb_enc_associate ( result , enc ) ; } <S2SV_StartBug> } <S2SV_EndBug> enc = rb_enc_check ( result , tmp ) ; rb_str_buf_append ( result , tmp ) ; rb_enc_associate ( result , enc ) ; } RBASIC_SET_CLASS_RAW ( result , rb_cString ) ; return result ; } | <S2SV_ModStart> ( VALUE ary <S2SV_ModEnd> ) { long <S2SV_ModStart> ; } } len += <S2SV_ModEnd> RARRAY_LEN ( ary <S2SV_ModStart> ) - 1 ; <S2SV_ModEnd> result = rb_str_buf_new <S2SV_ModStart> } else { <S2SV_ModEnd> tmp = rb_exec_recursive <S2SV_ModStart> , ary , tmp <S2SV_ModEnd> ) ; } <S2SV_ModStart> ; } else <S2SV_ModEnd> { tail = <S2SV_ModStart> tail ) { rb_str_cat ( result , "/" , 1 ) ; } } <S2SV_ModStart> ( result , tmp <S2SV_ModEnd> ) ; rb_str_buf_append <S2SV_ModStart> ( result , tmp <S2SV_ModEnd> ) ; rb_enc_associate <S2SV_ModStart> ) ; } <S2SV_ModEnd> RBASIC_SET_CLASS_RAW ( result |
4,651 | CWE-000 dentry_t * dentry_alloc ( const char * name ) { dentry_t * new = cache_alloc ( dentry_cache ) ; new -> name = name ; new -> inode = NULL ; new -> flags = 0 ; <S2SV_StartBug> hashtable_init ( new -> children_tab ) ; <S2SV_EndBug> list_init ( & new -> children_list ) ; return new ; } | <S2SV_ModStart> = 0 ; new -> parent = 0 ; |
4,652 | CWE-000 void command_issue ( uint32_t command_part ) { static cmd_state state = CMD_START ; switch ( state ) { case CMD_START : if ( command_part == SYS_CLEAR ) { command_clear ( ) ; state = CMD_START ; } else { curr_op . act = ( int ) command_part ; state = CMD_MID ; } break ; case CMD_MID : <S2SV_StartBug> state = CMD_DONE ; <S2SV_EndBug> break ; case CMD_DONE : if ( command_part == SYS_CLEAR ) { command_clear ( ) ; state = CMD_START ; } break ; } } | <S2SV_ModStart> case CMD_MID : curr_op . data = command_part ; |
4,653 | CWE-000 bool check_for_recommission ( int8_t bat ) { uint32_t time_since_decommission = get_current_timestamp_wrapped ( ) - charging_data . decommissioned_timestamp [ bat ] ; print ( "\\tdecomissioned<S2SV_blank>at<S2SV_blank>%d,<S2SV_blank>now<S2SV_blank>%d\\n" , charging_data . decommissioned_timestamp [ bat ] , get_current_timestamp_wrapped ( ) ) ; print ( "\\t%d<S2SV_blank>total<S2SV_blank>decommissions<S2SV_blank>for<S2SV_blank>this<S2SV_blank>bat\\n" , charging_data . decommissioned_count [ bat ] ) ; print ( "\\tthis<S2SV_blank>battery<S2SV_blank>should<S2SV_blank>be<S2SV_blank>decommissioned<S2SV_blank>for<S2SV_blank>%d\\n" , time_for_recommission ( bat ) ) ; if ( time_since_decommission > time_for_recommission ( bat ) ) { charging_data . decommissioned [ bat ] = 0 ; if ( is_lion ( bat ) ) { charging_data . decommissioned_timestamp [ bat ] = 0 ; <S2SV_StartBug> charging_data . li_entered_low_voltage_timestamp [ bat ] = - 1 ; <S2SV_EndBug> } return true ; } return false ; } | <S2SV_ModStart> bat ] = ( uint32_t ) |
4,654 | CWE-000 <S2SV_StartBug> void JR_cc ( CPU * c , BYTE cond ) { <S2SV_EndBug> <S2SV_StartBug> if ( CPU_CheckFlag ( c , cond ) ) { <S2SV_EndBug> c -> pc = c -> pc + ( SIGNED_BYTE ) IMM8 ( c ) ; CPU_UpdateClockTimer ( c , CYCLES ( 3 ) ) ; } else { c -> pc += 2 ; CPU_UpdateClockTimer ( c , CYCLES ( 2 ) ) ; } } | <S2SV_ModStart> , BYTE cond , bool not <S2SV_ModStart> , cond ) != not |
4,655 | CWE-000 STATIC int xfs_free_file_space ( xfs_inode_t * ip , xfs_off_t offset , xfs_off_t len , int attr_flags ) { int committed ; int done ; xfs_fileoff_t endoffset_fsb ; int error ; xfs_fsblock_t firstfsb ; xfs_bmap_free_t free_list ; xfs_bmbt_irec_t imap ; xfs_off_t ioffset ; xfs_extlen_t mod = 0 ; xfs_mount_t * mp ; int nimap ; uint resblks ; <S2SV_StartBug> uint rounding ; <S2SV_EndBug> int rt ; xfs_fileoff_t startoffset_fsb ; xfs_trans_t * tp ; int need_iolock = 1 ; mp = ip -> i_mount ; trace_xfs_free_file_space ( ip ) ; error = xfs_qm_dqattach ( ip , 0 ) ; if ( error ) return error ; error = 0 ; if ( len <= 0 ) return error ; rt = XFS_IS_REALTIME_INODE ( ip ) ; startoffset_fsb = XFS_B_TO_FSB ( mp , offset ) ; endoffset_fsb = XFS_B_TO_FSBT ( mp , offset + len ) ; if ( attr_flags & XFS_ATTR_NOLOCK ) need_iolock = 0 ; if ( need_iolock ) { xfs_ilock ( ip , XFS_IOLOCK_EXCL ) ; inode_dio_wait ( VFS_I ( ip ) ) ; } <S2SV_StartBug> rounding = max_t ( uint , 1 << mp -> m_sb . sb_blocklog , PAGE_CACHE_SIZE ) ; <S2SV_EndBug> ioffset = offset & ~ ( rounding - 1 ) ; error = - filemap_write_and_wait_range ( VFS_I ( ip ) -> i_mapping , ioffset , - 1 ) ; if ( error ) goto out_unlock_iolock ; truncate_pagecache_range ( VFS_I ( ip ) , ioffset , - 1 ) ; if ( rt && ! xfs_sb_version_hasextflgbit ( & mp -> m_sb ) ) { nimap = 1 ; error = xfs_bmapi_read ( ip , startoffset_fsb , 1 , & imap , & nimap , 0 ) ; if ( error ) goto out_unlock_iolock ; ASSERT ( nimap == 0 || nimap == 1 ) ; if ( nimap && imap . br_startblock != HOLESTARTBLOCK ) { xfs_daddr_t block ; ASSERT ( imap . br_startblock != DELAYSTARTBLOCK ) ; block = imap . br_startblock ; mod = do_div ( block , mp -> m_sb . sb_rextsize ) ; if ( mod ) startoffset_fsb += mp -> m_sb . sb_rextsize - mod ; } nimap = 1 ; error = xfs_bmapi_read ( ip , endoffset_fsb - 1 , 1 , & imap , & nimap , 0 ) ; if ( error ) goto out_unlock_iolock ; ASSERT ( nimap == 0 || nimap == 1 ) ; if ( nimap && imap . br_startblock != HOLESTARTBLOCK ) { ASSERT ( imap . br_startblock != DELAYSTARTBLOCK ) ; mod ++ ; if ( mod && ( mod != mp -> m_sb . sb_rextsize ) ) endoffset_fsb -= mod ; } } if ( ( done = ( endoffset_fsb <= startoffset_fsb ) ) ) error = xfs_zero_remaining_bytes ( ip , offset , offset + len - 1 ) ; else { if ( offset < XFS_FSB_TO_B ( mp , startoffset_fsb ) ) error = xfs_zero_remaining_bytes ( ip , offset , XFS_FSB_TO_B ( mp , startoffset_fsb ) - 1 ) ; if ( ! error && XFS_FSB_TO_B ( mp , endoffset_fsb ) < offset + len ) error = xfs_zero_remaining_bytes ( ip , XFS_FSB_TO_B ( mp , endoffset_fsb ) , offset + len - 1 ) ; } resblks = XFS_DIOSTRAT_SPACE_RES ( mp , 0 ) ; while ( ! error && ! done ) { tp = xfs_trans_alloc ( mp , XFS_TRANS_DIOSTRAT ) ; tp -> t_flags |= XFS_TRANS_RESERVE ; error = xfs_trans_reserve ( tp , resblks , XFS_WRITE_LOG_RES ( mp ) , 0 , XFS_TRANS_PERM_LOG_RES , XFS_WRITE_LOG_COUNT ) ; if ( error ) { ASSERT ( error == ENOSPC || XFS_FORCED_SHUTDOWN ( mp ) ) ; xfs_trans_cancel ( tp , 0 ) ; break ; } xfs_ilock ( ip , XFS_ILOCK_EXCL ) ; error = xfs_trans_reserve_quota ( tp , mp , ip -> i_udquot , ip -> i_gdquot , resblks , 0 , XFS_QMOPT_RES_REGBLKS ) ; if ( error ) goto error1 ; xfs_trans_ijoin ( tp , ip , 0 ) ; xfs_bmap_init ( & free_list , & firstfsb ) ; error = xfs_bunmapi ( tp , ip , startoffset_fsb , endoffset_fsb - startoffset_fsb , 0 , 2 , & firstfsb , & free_list , & done ) ; if ( error ) { goto error0 ; } error = xfs_bmap_finish ( & tp , & free_list , & committed ) ; if ( error ) { goto error0 ; } error = xfs_trans_commit ( tp , XFS_TRANS_RELEASE_LOG_RES ) ; xfs_iunlock ( ip , XFS_ILOCK_EXCL ) ; } out_unlock_iolock : if ( need_iolock ) xfs_iunlock ( ip , XFS_IOLOCK_EXCL ) ; return error ; error0 : xfs_bmap_cancel ( & free_list ) ; error1 : xfs_trans_cancel ( tp , XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT ) ; xfs_iunlock ( ip , need_iolock ? ( XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL ) : XFS_ILOCK_EXCL ) ; return error ; } | <S2SV_ModStart> uint resblks ; xfs_off_t <S2SV_ModEnd> rounding ; int <S2SV_ModStart> = max_t ( xfs_off_t <S2SV_ModEnd> , 1 << |
4,656 | CWE-000 int main ( int argc , char * argv [ ] ) { int rc ; int fd ; scmp_filter_ctx ctx = NULL ; fd = 1 ; ctx = seccomp_init ( SCMP_ACT_ALLOW ) ; if ( ctx == NULL ) { rc = ENOMEM ; goto out ; } rc = seccomp_arch_remove ( ctx , SCMP_ARCH_NATIVE ) ; if ( rc < 0 ) goto out ; rc = seccomp_arch_add ( ctx , SCMP_ARCH_X86_64 ) ; if ( rc < 0 ) goto out ; rc = seccomp_arch_add ( ctx , SCMP_ARCH_X86 ) ; if ( rc < 0 ) goto out ; rc = seccomp_rule_add ( ctx , SCMP_ACT_KILL , SCMP_SYS ( open ) , 0 ) ; if ( rc < 0 ) goto out ; rc = seccomp_rule_add ( ctx , SCMP_ACT_KILL , SCMP_SYS ( read ) , 4 , SCMP_A0 ( SCMP_CMP_EQ , 0 ) , SCMP_A1 ( SCMP_CMP_GE , 1 ) , SCMP_A2 ( SCMP_CMP_GT , 2 ) , SCMP_A3 ( SCMP_CMP_MASKED_EQ , 0x0f , 3 ) ) ; if ( rc < 0 ) goto out ; rc = seccomp_rule_add ( ctx , SCMP_ACT_TRAP , SCMP_SYS ( write ) , 3 , SCMP_A0 ( SCMP_CMP_NE , 0 ) , SCMP_A1 ( SCMP_CMP_LE , 1 ) , SCMP_A2 ( SCMP_CMP_LT , 2 ) ) ; if ( rc < 0 ) goto out ; rc = seccomp_rule_add ( ctx , SCMP_ACT_ERRNO ( 1 ) , SCMP_SYS ( close ) , 0 ) ; if ( rc < 0 ) goto out ; rc = seccomp_rule_add ( ctx , SCMP_ACT_TRACE ( 1 ) , SCMP_SYS ( exit ) , 0 ) ; if ( rc < 0 ) goto out ; <S2SV_StartBug> rc = seccomp_export_pfc ( ctx , fd ) ; <S2SV_EndBug> if ( rc < 0 ) goto out ; out : seccomp_release ( ctx ) ; close ( fd ) ; return ( rc < 0 ? - rc : rc ) ; } | <S2SV_ModStart> ; rc = seccomp_syscall_priority ( ctx , SCMP_SYS ( poll ) , 255 ) ; if ( rc < 0 ) goto out ; rc = |
4,657 | CWE-000 struct bstrList * get_replay_list ( ) { DIR * replay_dir = opendir ( "replay" ) ; check ( replay_dir != NULL , "Could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>replay<S2SV_blank>directory<S2SV_blank>for<S2SV_blank>reading" ) ; struct dirent * d = NULL ; struct bstrList * b = malloc ( sizeof ( struct bstrList ) ) ; b -> entry = malloc ( 200 * sizeof ( bstring ) ) ; b -> qty = 200 ; int num = 0 ; int i = 0 ; for ( i = 0 ; ; i ++ ) { d = readdir ( replay_dir ) ; if ( ! d ) break ; <S2SV_StartBug> if ( d -> d_type != DT_REG ) <S2SV_EndBug> continue ; num ++ ; if ( num > b -> qty ) { b -> qty *= 2 ; b -> entry = realloc ( b -> entry , b -> qty * sizeof ( bstring ) ) ; } b -> entry [ num - 1 ] = bformat ( "replay/%s" , d -> d_name ) ; } b -> qty = num ; b -> entry = realloc ( b -> entry , num * sizeof ( bstring ) ) ; return b ; error : return NULL ; } | <S2SV_ModStart> ) break ; <S2SV_ModEnd> num ++ ; |
4,658 | CWE-000 static void Ai_Wander ( g_entity_t * self , pm_cmd_t * cmd ) { ai_locals_t * ai = Ai_GetLocals ( self ) ; vec3_t forward ; AngleVectors ( ( const vec3_t ) { 0 , ai -> wander_angle , 0 } , forward , NULL , NULL ) ; vec3_t end ; VectorMA ( self -> s . origin , ( self -> maxs [ 0 ] - self -> mins [ 0 ] ) * 2.0 , forward , end ) ; cm_trace_t tr = aim . Trace ( self -> s . origin , end , vec3_origin , vec3_origin , self , MASK_CLIP_PLAYER ) ; if ( tr . fraction < 1.0 ) { vec_t angle = 45 + Randomf ( ) * 45 ; ai -> wander_angle += ( Randomf ( ) < 0.5 ) ? - angle : angle ; ai -> wander_angle = ClampAngle ( ai -> wander_angle ) ; } vec3_t move_dir ; VectorSubtract ( ai -> last_origin , self -> s . origin , move_dir ) ; move_dir [ 2 ] = 0.0 ; vec_t move_len = VectorLength ( move_dir ) ; if ( move_len < ( PM_SPEED_RUN * QUETOO_TICK_SECONDS ) / 8.0 ) { ai -> no_movement_frames ++ ; <S2SV_StartBug> if ( ai -> no_movement_frames >= QUETOO_TICK_RATE / 2.0 ) { <S2SV_EndBug> cmd -> up = PM_SPEED_JUMP ; } else if ( ai -> no_movement_frames >= QUETOO_TICK_RATE ) { vec_t angle = 45 + Randomf ( ) * 45 ; ai -> wander_angle += ( Randomf ( ) < 0.5 ) ? - angle : angle ; ai -> wander_angle = ClampAngle ( ai -> wander_angle ) ; ai -> no_movement_frames = 0 ; } <S2SV_StartBug> } else { <S2SV_EndBug> ai -> no_movement_frames = 0 ; } } | <S2SV_ModStart> no_movement_frames >= QUETOO_TICK_RATE <S2SV_ModEnd> ) { vec_t <S2SV_ModStart> 0 ; } else if ( ai -> no_movement_frames >= QUETOO_TICK_RATE / 2.0 ) { cmd -> up = PM_SPEED_JUMP ; } } else <S2SV_ModEnd> { ai -> |
4,659 | CWE-000 void unmask_threaded_irq ( struct irq_desc * desc ) { struct irq_chip * chip = desc -> irq_data . chip ; if ( chip -> flags & IRQCHIP_EOI_THREADED ) chip -> irq_eoi ( & desc -> irq_data ) ; <S2SV_StartBug> if ( chip -> irq_unmask ) { <S2SV_EndBug> chip -> irq_unmask ( & desc -> irq_data ) ; irq_state_clr_masked ( desc ) ; } <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> irq_data ) ; unmask_irq <S2SV_ModEnd> ( desc ) <S2SV_ModStart> ) ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null> |
4,660 | CWE-000 int save_mino ( char * str , t_mino * mino , int id ) { t_mino * last ; t_mino * new ; new = mino ; if ( new -> pos == '\\0' ) new -> pos = mino_pos ( str ) ; else { while ( new -> next ) new = new -> next ; new -> next = ( t_mino * ) ft_memalloc ( sizeof ( t_mino ) ) ; if ( new -> next == NULL ) return ( 0 ) ; last = new ; new = new -> next ; new -> pos = mino_pos ( str ) ; new -> prev = last ; } new -> id = id + 0x41 ; new -> next = NULL ; new -> skew = new -> pos ; <S2SV_StartBug> return ( 1 ) ; <S2SV_EndBug> } | <S2SV_ModStart> -> pos ; printf ( "mino<S2SV_blank>pos:<S2SV_blank>%d,<S2SV_blank>%d,<S2SV_blank>%d,<S2SV_blank>%d\\n" , new -> pos [ 0 ] , new -> pos [ 1 ] , new -> pos [ 2 ] , new -> pos [ 3 ] ) ; |
4,661 | CWE-000 int command_add ( t_core * core , t_process * process ) { if ( ARGS [ 0 ] . type == REG_CODE && ARGS [ 1 ] . type == REG_CODE && ARGS [ 2 ] . type == REG_CODE && ARGS [ 0 ] . arg <= REG_NUMBER && ARGS [ 0 ] . arg > 0 && ARGS [ 1 ] . arg <= REG_NUMBER && ARGS [ 1 ] . arg > 0 && ARGS [ 2 ] . arg <= REG_NUMBER && ARGS [ 2 ] . arg > 0 ) { REG [ ARGS [ 2 ] . arg - 1 ] = REG [ ARGS [ 0 ] . arg - 1 ] + REG [ ARGS [ 1 ] . arg - 1 ] ; process -> carry = REG [ ARGS [ 2 ] . arg - 1 ] ? 0 : 1 ; } <S2SV_StartBug> print_flag_v ( core , process ) ; <S2SV_EndBug> return ( 1 ) ; } | <S2SV_ModStart> 1 ; } FLAGS -> visual ? 0 : |
4,662 | CWE-000 static gboolean parse_file_contents ( GnomeBGSlideShow * self , const char * contents , gsize len , GError * * error ) { GMarkupParser parser = { handle_start_element , handle_end_element , handle_text , NULL , NULL , } ; GMarkupParseContext * context = NULL ; time_t t ; gboolean failed = FALSE ; threadsafe_localtime ( ( time_t ) 0 , & self -> priv -> start_tm ) ; context = g_markup_parse_context_new ( & parser , 0 , self , NULL ) ; if ( ! g_markup_parse_context_parse ( context , contents , len , error ) ) { failed = TRUE ; } if ( ! failed && ! g_markup_parse_context_end_parse ( context , error ) ) { failed = TRUE ; } g_markup_parse_context_free ( context ) ; if ( ! failed ) { <S2SV_StartBug> int len ; <S2SV_EndBug> t = mktime ( & self -> priv -> start_tm ) ; self -> priv -> start_time = ( double ) t ; len = g_queue_get_length ( self -> priv -> slides ) ; if ( len == 0 ) { g_set_error_literal ( error , G_MARKUP_ERROR , G_MARKUP_ERROR_INVALID_CONTENT , "file<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>slide<S2SV_blank>show<S2SV_blank>since<S2SV_blank>it<S2SV_blank>has<S2SV_blank>no<S2SV_blank>slides" ) ; failed = TRUE ; } else if ( len == 1 ) { Slide * slide = self -> priv -> slides -> head -> data ; slide -> duration = self -> priv -> total_duration = G_MAXUINT ; } } return ! failed ; } | <S2SV_ModStart> failed ) { guint <S2SV_ModEnd> len ; t |
4,663 | CWE-000 int bond_parse_conf ( FILE * fp , char * conf_buff , int buff_len ) { if ( fp == NULL || conf_buff == NULL || buff_len < 1 ) { printf ( "Invalid<S2SV_blank>parameter\\n" ) ; return - 1 ; } PORT_CACHE port_conf ; int res = 0x00 ; while ( ! feof ( fp ) ) { memset ( conf_buff , 0x00 , buff_len ) ; if ( fgets ( conf_buff , buff_len , fp ) == NULL ) { printf ( "Error<S2SV_blank>on<S2SV_blank>read<S2SV_blank>conf\\n" ) ; return - 1 ; } else { DEBUG_INFO ( "reading<S2SV_blank>conf..." ) ; memset ( & port_conf , 0x00 , sizeof ( port_conf ) ) ; if ( bond_do_parse ( conf_buff , & port_conf ) < 0 ) { continue ; } else { if ( check_diff ( & bonding_global -> phead , & port_conf ) == NULL ) { DEBUG_INFO ( "ERROR,failed<S2SV_blank>on<S2SV_blank>check_diff" ) ; exit ( - 1 ) ; } } } } res = user_del_bond ( & bonding_global -> phead ) ; if ( res == - 1 ) { DEBUG_INFO ( "ERROR,Invalid<S2SV_blank>parameter" ) ; exit ( - 1 ) ; } else { DEBUG_INFO ( "%d<S2SV_blank>bond<S2SV_blank>port(s)<S2SV_blank>successfully<S2SV_blank>deleted<S2SV_blank>" , res ) ; } <S2SV_StartBug> DEBUG_INFO ( "Totally<S2SV_blank>%d<S2SV_blank>bond<S2SV_blank>port(s)<S2SV_blank>configured<S2SV_blank>correctly,<S2SV_blank>%d<S2SV_blank>bond<S2SV_blank>port(s)<S2SV_blank>configured<S2SV_blank>error\\n" , <S2SV_EndBug> bond_count , err_count ) ; return 0 ; } | <S2SV_ModStart> } DEBUG_INFO ( "Totally<S2SV_blank>%d<S2SV_blank>bond<S2SV_blank>port(s)<S2SV_blank>configured<S2SV_blank>correctly,<S2SV_blank>" "%d<S2SV_blank>bond<S2SV_blank>port(s)<S2SV_blank>configured<S2SV_blank>error" <S2SV_ModEnd> , bond_count , |
4,664 | CWE-000 static void * esdi_init ( ) { int i = 0 ; esdi_t * esdi = malloc ( sizeof ( esdi_t ) ) ; memset ( esdi , 0 , sizeof ( esdi_t ) ) ; <S2SV_StartBug> rom_init_interleaved ( & esdi -> bios_rom , "roms/90x8970.bin" , "roms/90x8969.bin" , 0xc8000 , 0x4000 , 0x3fff , 0 , MEM_MAPPING_EXTERNAL ) ; <S2SV_EndBug> mem_mapping_disable ( & esdi -> bios_rom . mapping ) ; for ( i = 0 ; i < HDC_NUM ; i ++ ) { loadhd ( esdi , hdc [ i ] . mfm_channel , hdd_fn [ i ] ) ; } timer_add ( esdi_callback , & esdi -> callback , & esdi -> callback , esdi ) ; mca_add ( esdi_mca_read , esdi_mca_write , esdi ) ; esdi -> pos_regs [ 0 ] = 0xff ; esdi -> pos_regs [ 1 ] = 0xdd ; esdi -> in_reset = 1 ; esdi -> callback = ESDI_TIME * 50 ; esdi -> status = STATUS_BUSY ; return esdi ; } | <S2SV_ModStart> -> bios_rom , L"roms/90x8970.bin" , L"roms/90x8969.bin" <S2SV_ModEnd> , 0xc8000 , |
4,665 | CWE-000 void * w_input_thread ( __attribute__ ( ( unused ) ) void * t_id ) { logreader * current ; int i = 0 , r = 0 , j = - 1 ; int f_check = 0 ; IT_control f_control = 0 ; time_t curr_time = 0 ; # ifndef WIN32 int int_error = 0 ; struct timeval fp_timeout ; # endif while ( 1 ) { # ifndef WIN32 fp_timeout . tv_sec = loop_timeout ; fp_timeout . tv_usec = 0 ; if ( ( r = select ( 0 , NULL , NULL , NULL , & fp_timeout ) ) < 0 ) { merror ( SELECT_ERROR , errno , strerror ( errno ) ) ; int_error ++ ; if ( int_error >= 5 ) { merror_exit ( SYSTEM_ERROR ) ; } continue ; } # else sleep ( loop_timeout + 2 ) ; <S2SV_StartBug> win_readel ( ) ; <S2SV_EndBug> # endif f_check ++ ; for ( i = 0 , j = - 1 ; ; i ++ ) { w_rwlock_rdlock ( & files_update_rwlock ) ; if ( f_control = update_current ( & current , & i , & j ) , f_control ) { if ( f_control == NEXT_IT ) { w_rwlock_unlock ( & files_update_rwlock ) ; continue ; } else { w_rwlock_unlock ( & files_update_rwlock ) ; break ; } } w_rwlock_unlock ( & files_update_rwlock ) ; if ( pthread_mutex_trylock ( & current -> mutex ) == 0 ) { if ( ! current -> fp ) { if ( current -> command ) { curr_time = time ( 0 ) ; if ( ( curr_time - current -> size ) >= current -> ign ) { current -> size = curr_time ; current -> read ( current , & r , 0 ) ; } } pthread_mutex_unlock ( & current -> mutex ) ; continue ; } # ifndef WIN32 if ( ( r = fgetc ( current -> fp ) ) == EOF ) { clearerr ( current -> fp ) ; pthread_mutex_unlock ( & current -> mutex ) ; continue ; } ungetc ( r , current -> fp ) ; # endif current -> read ( current , & r , 0 ) ; if ( ! ferror ( current -> fp ) ) { clearerr ( current -> fp ) ; if ( r != 0 ) { current -> ign ++ ; } pthread_mutex_unlock ( & current -> mutex ) ; } else { merror ( FREAD_ERROR , current -> file , errno , strerror ( errno ) ) ; # ifndef WIN32 if ( fseek ( current -> fp , 0 , SEEK_END ) < 0 ) # else if ( 1 ) # endif { # ifndef WIN32 merror ( FSEEK_ERROR , current -> file , errno , strerror ( errno ) ) ; # endif fclose ( current -> fp ) ; # ifdef WIN32 CloseHandle ( current -> h ) ; # endif current -> fp = NULL ; if ( handle_file ( i , j , 1 , 1 ) ) { current -> ign ++ ; pthread_mutex_unlock ( & current -> mutex ) ; continue ; } # ifdef WIN32 current -> read ( current , & r , 1 ) ; # endif } current -> ign ++ ; clearerr ( current -> fp ) ; pthread_mutex_unlock ( & current -> mutex ) ; } } else { continue ; } } } return NULL ; } | <S2SV_ModStart> 2 ) ; if ( pthread_mutex_trylock ( & win_el_mutex ) == 0 ) { <S2SV_ModStart> ( ) ; pthread_mutex_unlock ( & win_el_mutex ) ; } |
4,666 | CWE-000 int load_file ( const char * path , off_t offset , size_t size , char * out_data ) { log_trace ( "Loading<S2SV_blank>file:<S2SV_blank>%s<S2SV_blank>at<S2SV_blank>offset<S2SV_blank>%lu<S2SV_blank>with<S2SV_blank>size<S2SV_blank>%lu" , <S2SV_StartBug> path , offset , size ) ; <S2SV_EndBug> if ( size == 0 ) return 0 ; unsigned char sha1_key [ SHA_DIGEST_LENGTH ] ; SHA1 ( path , strlen ( path ) , sha1_key ) ; struct stat sb ; if ( load_stat ( path , & sb ) != 0 ) { log_error ( "Metadata<S2SV_blank>should<S2SV_blank>have<S2SV_blank>been<S2SV_blank>saved<S2SV_blank>first!" ) ; return - 1 ; } <S2SV_StartBug> size_t max_read = NFS_REDIS_MIN ( sb . st_size , offset + size ) ; <S2SV_EndBug> size_t chunk_number ; off_t curr_off_data = 0 ; for ( chunk_number = offset / chunk_size ; chunk_number * chunk_size < max_read ; chunk_number ++ ) { off_t chk_off = NFS_REDIS_MIN ( offset - chunk_number * chunk_size , 0 ) ; size_t chk_end = NFS_REDIS_MIN ( chunk_size , max_read - chunk_number * chunk_size ) ; log_debug ( "Loading<S2SV_blank>chunk<S2SV_blank>number<S2SV_blank>%lu<S2SV_blank>from<S2SV_blank>bytes<S2SV_blank>%lu<S2SV_blank>to<S2SV_blank>%lu" , chunk_number , chk_off , chk_end ) ; int ret = load_chunk_data ( sha1_key , chunk_number , out_data + curr_off_data , chk_off , chk_end ) ; if ( ret != 0 ) { log_error ( "Failed<S2SV_blank>loading<S2SV_blank>chunk<S2SV_blank>number<S2SV_blank>%lu<S2SV_blank>from<S2SV_blank>bytes<S2SV_blank>%lu<S2SV_blank>to<S2SV_blank>%lu" , chunk_number , chk_off , chk_end ) ; return - 1 ; } curr_off_data += chk_end - chk_off ; } log_trace ( "End<S2SV_blank>load<S2SV_blank>file" ) ; return max_read - offset > 0 ? max_read - offset : 0 ; } | <S2SV_ModStart> , size ) <S2SV_ModEnd> ; unsigned char <S2SV_ModStart> 1 ; } if ( size == 0 ) return 0 ; |
4,667 | CWE-000 bfd_reloc_code_real_type return_reloc ( fusion_opc_info_t * insn , char * str ) { insn_t opc = insn -> opc ; insn_t dsel = insn -> index ; insn_t usereg = insn -> index ; unsigned cpid_value = insn -> cpid ; bfd_reloc_code_real_type ret_reloc = BFD_RELOC_UNUSED ; switch ( opc ) { case OPC_INT : break ; case OPC_IMM : ret_reloc = BFD_RELOC_FUSION_12 ; break ; case OPC_LD : ret_reloc = BFD_RELOC_FUSION_LOAD ; break ; case OPC_ST : ret_reloc = BFD_RELOC_FUSION_STORE ; break ; case OPC_LI : switch ( dsel ) { case 3 : case 4 : case 5 : <S2SV_StartBug> ret_reloc = BFD_RELOC_FUSION_HI16 ; <S2SV_EndBug> break ; case 0 : case 1 : <S2SV_StartBug> case 2 : <S2SV_EndBug> default : ret_reloc = BFD_RELOC_16 ; break ; } break ; case OPC_JMP : if ( cpid_value == CPID_MACRO ) { ret_reloc = BFD_RELOC_FUSION_21 ; break ; } switch ( usereg ) { case 0 : ret_reloc = BFD_RELOC_FUSION_21_PCREL ; break ; case 1 : ret_reloc = BFD_RELOC_FUSION_21 ; break ; default : as_fatal ( _ ( "What<S2SV_blank>did<S2SV_blank>you<S2SV_blank>do??<S2SV_blank>That<S2SV_blank>jump<S2SV_blank>insn<S2SV_blank>can\'t<S2SV_blank>have<S2SV_blank>a<S2SV_blank>third<S2SV_blank>option<S2SV_blank>in<S2SV_blank>whether<S2SV_blank>it<S2SV_blank>uses<S2SV_blank>regs<S2SV_blank>or<S2SV_blank>not" ) ) ; break ; } break ; case OPC_JLNK : if ( cpid_value == CPID_MACRO ) { ret_reloc = BFD_RELOC_FUSION_21 ; break ; } switch ( usereg ) { case 0 : ret_reloc = BFD_RELOC_FUSION_21_PCREL ; break ; case 1 : ret_reloc = BFD_RELOC_FUSION_21 ; break ; default : as_fatal ( _ ( "What<S2SV_blank>did<S2SV_blank>you<S2SV_blank>do??<S2SV_blank>That<S2SV_blank>jump<S2SV_blank>insn<S2SV_blank>can\'t<S2SV_blank>have<S2SV_blank>a<S2SV_blank>third<S2SV_blank>option<S2SV_blank>in<S2SV_blank>whether<S2SV_blank>it<S2SV_blank>uses<S2SV_blank>regs<S2SV_blank>or<S2SV_blank>not" ) ) ; break ; } break ; case OPC_BRANCH : ret_reloc = BFD_RELOC_FUSION_14_PCREL ; break ; case OPC_SYS : if ( insn -> imm_mask == MASK_NO_IMM ) break ; ret_reloc = BFD_RELOC_8 ; break ; case 0x00 : break ; default : as_bad ( _ ( "Unknown<S2SV_blank>opcode,<S2SV_blank>how<S2SV_blank>did<S2SV_blank>you<S2SV_blank>manage<S2SV_blank>that?:<S2SV_blank>%s" ) , str ) ; break ; } return ret_reloc ; } | <S2SV_ModStart> case 5 : case 11 : case 12 : case 13 : <S2SV_ModStart> : case 2 : case 8 : case 9 : case 10 |
4,668 | CWE-000 int tpm_get_random ( struct tpm_chip * chip , u8 * out , size_t max ) { struct tpm_cmd_t tpm_cmd ; u32 recd , num_bytes = min_t ( u32 , max , TPM_MAX_RNG_DATA ) , rlength ; int err , total = 0 , retries = 5 ; u8 * dest = out ; if ( ! out || ! num_bytes || max > TPM_MAX_RNG_DATA ) return - EINVAL ; chip = tpm_find_get_ops ( chip ) ; if ( ! chip ) return - ENODEV ; if ( chip -> flags & TPM_CHIP_FLAG_TPM2 ) { err = tpm2_get_random ( chip , out , max ) ; tpm_put_ops ( chip ) ; return err ; } do { tpm_cmd . header . in = tpm_getrandom_header ; tpm_cmd . params . getrandom_in . num_bytes = cpu_to_be32 ( num_bytes ) ; err = tpm_transmit_cmd ( chip , NULL , & tpm_cmd , TPM_GETRANDOM_RESULT_SIZE + num_bytes , offsetof ( struct tpm_getrandom_out , rng_data ) , 0 , "attempting<S2SV_blank>get<S2SV_blank>random" ) ; if ( err ) break ; recd = be32_to_cpu ( tpm_cmd . params . getrandom_out . rng_data_len ) ; if ( recd > num_bytes ) { total = - EFAULT ; break ; } rlength = be32_to_cpu ( tpm_cmd . header . out . length ) ; <S2SV_StartBug> if ( rlength < offsetof ( struct tpm_getrandom_out , rng_data ) + <S2SV_EndBug> recd ) { total = - EFAULT ; break ; } memcpy ( dest , tpm_cmd . params . getrandom_out . rng_data , recd ) ; dest += recd ; total += recd ; num_bytes -= recd ; } while ( retries -- && total < max ) ; tpm_put_ops ( chip ) ; return total ? total : - EIO ; } | <S2SV_ModStart> ( rlength < TPM_HEADER_SIZE + |
4,669 | CWE-000 <S2SV_StartBug> void rs_free_sta ( void * mvm_r , struct ieee80211_sta * sta , void * mvm_sta ) <S2SV_EndBug> { struct iwl_op_mode * op_mode __maybe_unused = mvm_r ; struct iwl_mvm * mvm __maybe_unused = IWL_OP_MODE_GET_MVM ( op_mode ) ; IWL_DEBUG_RATE ( mvm , "enter\\n" ) ; IWL_DEBUG_RATE ( mvm , "leave\\n" ) ; } | <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static |
4,670 | CWE-000 corto_object _corto_mount_resume ( corto_mount this , corto_string parent , corto_string name , corto_object o ) { if ( this -> policy . ownership != CORTO_LOCAL_OWNER ) { return NULL ; } corto_attr prevAttr = corto_setAttr ( CORTO_ATTR_PERSISTENT | corto_getAttr ( ) ) ; corto_object prevOwner = corto_setOwner ( this ) ; corto_object result = NULL ; if ( this -> hasResume ) { corto_debug ( "mount:<S2SV_blank>onResume<S2SV_blank>parent=%s,<S2SV_blank>expr=%s<S2SV_blank>(mount<S2SV_blank>=<S2SV_blank>%s,<S2SV_blank>o<S2SV_blank>=<S2SV_blank>%p)" , parent , name , corto_fullpath ( NULL , this ) , o ) ; result = corto_mount_onResume ( this , parent , name , o ) ; } else { corto_id type ; corto_query q ; corto_bool newObject = FALSE ; memset ( & q , 0 , sizeof ( q ) ) ; q . select = name ; q . from = parent ; if ( o ) { corto_fullpath ( type , corto_typeof ( o ) ) ; } else { type [ 0 ] = '\\0' ; } q . type = type ; q . content = TRUE ; corto_debug ( "mount:<S2SV_blank>try<S2SV_blank>resume<S2SV_blank>for<S2SV_blank>\'%s/%s\'<S2SV_blank>(mount<S2SV_blank>=<S2SV_blank>\'%s\')" , parent , name , corto_fullpath ( NULL , this ) ) ; corto_resultIter it = corto_mount_query ( this , & q ) ; if ( corto_iter_hasNext ( & it ) ) { corto_result * iterResult = corto_iter_next ( & it ) ; if ( ! o ) { if ( iterResult -> parent [ 0 ] == '/' ) { corto_error ( "mount<S2SV_blank>%s:%s<S2SV_blank>returned<S2SV_blank>fully<S2SV_blank>qualified<S2SV_blank>parent<S2SV_blank>\'%s\',<S2SV_blank>expected<S2SV_blank>a<S2SV_blank>path<S2SV_blank>relative<S2SV_blank>to<S2SV_blank>mount" , corto_fullpath ( NULL , this ) , corto_fullpath ( NULL , corto_typeof ( this ) ) , iterResult -> parent ) ; goto error ; } corto_id fullparent ; sprintf ( fullparent , "%s/%s" , corto_subscriber ( this ) -> query . from , iterResult -> parent ) ; corto_cleanpath ( fullparent , fullparent ) ; corto_object parent_o = corto_lookup ( NULL , fullparent ) ; if ( parent_o ) { corto_object type_o = corto_resolve ( NULL , iterResult -> type ) ; if ( type_o ) { o = corto_declareChild ( parent_o , iterResult -> id , type_o ) ; if ( ! o ) { corto_seterr ( "failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>object<S2SV_blank>%s/%s:<S2SV_blank>%s" , parent , name , corto_lasterr ( ) ) ; } newObject = TRUE ; corto_release ( type_o ) ; } else { corto_seterr ( "unresolved<S2SV_blank>type<S2SV_blank>\'%s\'<S2SV_blank>of<S2SV_blank>object<S2SV_blank>\'%s\'<S2SV_blank>returned<S2SV_blank>by<S2SV_blank>\'%s\'" , iterResult -> type , iterResult -> id , corto_fullpath ( NULL , this ) ) ; goto error ; } corto_release ( parent_o ) ; } else { corto_seterr ( "parent<S2SV_blank>\'%s\'<S2SV_blank>is<S2SV_blank>not<S2SV_blank>provided<S2SV_blank>by<S2SV_blank>any<S2SV_blank>mount,<S2SV_blank>cannot<S2SV_blank>resume<S2SV_blank>\'%s/%s\'" , fullparent , parent , name ) ; goto error ; } } if ( o ) { corto_value v = corto_value_object ( o , NULL ) ; if ( corto_subscriber ( this ) -> contentTypeHandle && iterResult -> value ) { ( ( corto_contentType ) corto_subscriber ( this ) -> contentTypeHandle ) -> toValue ( & v , iterResult -> value ) ; } if ( newObject ) { corto_define ( o ) ; } result = o ; } } if ( corto_iter_hasNext ( & it ) ) { corto_error ( "corto:<S2SV_blank>mount<S2SV_blank>should<S2SV_blank>not<S2SV_blank>return<S2SV_blank>more<S2SV_blank>than<S2SV_blank>one<S2SV_blank>object<S2SV_blank>(scope<S2SV_blank>=<S2SV_blank>\'%s\',<S2SV_blank>id<S2SV_blank>=<S2SV_blank>\'%s\')" , parent , name ) ; do { corto_result * r = corto_iter_next ( & it ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>excess<S2SV_blank>result:<S2SV_blank>%s/%s\\n" , r -> parent , r -> id ) ; } while ( corto_iter_hasNext ( & it ) ) ; goto error ; } } corto_setAttr ( prevAttr ) ; corto_setOwner ( prevOwner ) ; if ( result ) { <S2SV_StartBug> corto_trace ( "mount:<S2SV_blank>resumed<S2SV_blank>\'%s/%s\'<S2SV_blank>from<S2SV_blank>\'%s\'" , parent , name , corto_fullpath ( NULL , this ) ) ; <S2SV_EndBug> } return result ; error : return NULL ; } | <S2SV_ModStart> result ) { corto_debug <S2SV_ModEnd> ( "mount:<S2SV_blank>resumed<S2SV_blank>\'%s/%s\'<S2SV_blank>from<S2SV_blank>\'%s\'" , |
4,671 | CWE-000 void zdb_record_score ( Oid index_relid , ItemPointer ctid , ZDBScore score ) { MemoryContext oldContext = MemoryContextSwitchTo ( TopTransactionContext ) ; bool found ; ZDBBitmapScoreKey key ; ZDBBitmapScoreEntry * entry ; if ( bitmapScores == NULL ) { HASHCTL ctl ; <S2SV_StartBug> ctl . keysize = sizeof ( ZDBBitmapScoreKey ) ; <S2SV_EndBug> ctl . entrysize = sizeof ( ZDBBitmapScoreEntry ) ; ctl . hcxt = TopTransactionContext ; ctl . hash = tag_hash ; <S2SV_StartBug> bitmapScores = hash_create ( "zdb<S2SV_blank>bitmap<S2SV_blank>scores" , 32768 , & ctl , HASH_FUNCTION | HASH_CONTEXT ) ; <S2SV_EndBug> } key . index_relid = index_relid ; memcpy ( & key . ctid , ctid , sizeof ( ItemPointerData ) ) ; entry = hash_search ( bitmapScores , & key , HASH_ENTER , & found ) ; memcpy ( & entry -> score , & score , sizeof ( ZDBScore ) ) ; MemoryContextSwitchTo ( oldContext ) ; } | <S2SV_ModStart> HASHCTL ctl ; memset ( & ctl , 0 , sizeof ( ctl ) ) ; <S2SV_ModStart> & ctl , HASH_ELEM | |
4,672 | CWE-000 static int unforce_rtp_proxy1_f ( struct sip_msg * msg , char * str1 , char * str2 ) { str flags ; <S2SV_StartBug> if ( str1 ) <S2SV_EndBug> <S2SV_StartBug> get_str_fparam ( & flags , msg , ( fparam_t * ) str1 ) ; <S2SV_EndBug> else <S2SV_StartBug> flags . s = NULL ; <S2SV_EndBug> return unforce_rtp_proxy ( msg , flags . s ) ; } | <S2SV_ModStart> ( str1 ) { if ( <S2SV_ModStart> ) str1 ) < 0 ) { LM_ERR ( "failed<S2SV_blank>to<S2SV_blank>get<S2SV_blank>flags<S2SV_blank>parameter\\n" ) ; return - 1 ; } } else { <S2SV_ModEnd> flags . s <S2SV_ModStart> = NULL ; } |
4,673 | CWE-000 static void uvc_video_clock_decode ( struct uvc_streaming * stream , struct uvc_buffer * buf , const __u8 * data , int len ) { struct uvc_clock_sample * sample ; unsigned int header_size ; bool has_pts = false ; bool has_scr = false ; unsigned long flags ; struct timespec ts ; u16 host_sof ; u16 dev_sof ; switch ( data [ 1 ] & ( UVC_STREAM_PTS | UVC_STREAM_SCR ) ) { case UVC_STREAM_PTS | UVC_STREAM_SCR : header_size = 12 ; has_pts = true ; has_scr = true ; break ; case UVC_STREAM_PTS : header_size = 6 ; has_pts = true ; break ; case UVC_STREAM_SCR : header_size = 8 ; has_scr = true ; break ; default : header_size = 2 ; break ; } if ( len < header_size ) return ; if ( has_pts && buf != NULL ) buf -> pts = get_unaligned_le32 ( & data [ 2 ] ) ; if ( ! has_scr ) return ; dev_sof = get_unaligned_le16 ( & data [ header_size - 2 ] ) ; if ( dev_sof == stream -> clock . last_sof ) return ; stream -> clock . last_sof = dev_sof ; host_sof = usb_get_current_frame_number ( stream -> dev -> udev ) ; <S2SV_StartBug> ktime_get_ts ( & ts ) ; <S2SV_EndBug> if ( stream -> clock . sof_offset == ( u16 ) - 1 ) { u16 delta_sof = ( host_sof - dev_sof ) & 255 ; if ( delta_sof >= 10 ) stream -> clock . sof_offset = delta_sof ; else stream -> clock . sof_offset = 0 ; } dev_sof = ( dev_sof + stream -> clock . sof_offset ) & 2047 ; spin_lock_irqsave ( & stream -> clock . lock , flags ) ; sample = & stream -> clock . samples [ stream -> clock . head ] ; sample -> dev_stc = get_unaligned_le32 ( & data [ header_size - 6 ] ) ; sample -> dev_sof = dev_sof ; sample -> host_sof = host_sof ; sample -> host_ts = ts ; stream -> clock . head = ( stream -> clock . head + 1 ) % stream -> clock . size ; if ( stream -> clock . count < stream -> clock . size ) stream -> clock . count ++ ; spin_unlock_irqrestore ( & stream -> clock . lock , flags ) ; } | <S2SV_ModStart> udev ) ; uvc_video_get_ts <S2SV_ModEnd> ( & ts |
4,674 | CWE-000 void print_expression ( const Exp * n ) { <S2SV_StartBug> print_expression_parens ( n , false ) ; <S2SV_EndBug> <S2SV_StartBug> err_msg ( lg_Debug , "\\n" ) ; <S2SV_EndBug> } | <S2SV_ModStart> n ) { dyn_str * e = dyn_str_new ( ) ; char * s = dyn_str_take ( print_expression_parens ( e , <S2SV_ModEnd> n , false <S2SV_ModStart> n , false ) <S2SV_ModStart> ( lg_Debug , "%s\\n" , s ) ; free ( s <S2SV_ModEnd> ) ; } |
4,675 | CWE-000 static int wd_standby ( struct wd_softc * wd , int flags ) { struct ata_xfer * xfer ; int error ; xfer = ata_get_xfer ( wd -> drvp -> chnl_softc ) ; if ( xfer == NULL ) return EINTR ; xfer -> c_ata_c . r_command = WDCC_STANDBY_IMMED ; xfer -> c_ata_c . r_st_bmask = WDCS_DRDY ; xfer -> c_ata_c . r_st_pmask = WDCS_DRDY ; xfer -> c_ata_c . flags = flags ; xfer -> c_ata_c . timeout = 30000 ; if ( wd -> atabus -> ata_exec_command ( wd -> drvp , xfer ) != ATACMD_COMPLETE ) { aprint_error_dev ( wd -> sc_dev , "standby<S2SV_blank>immediate<S2SV_blank>command<S2SV_blank>didn\'t<S2SV_blank>complete\\n" ) ; error = EIO ; goto out ; } if ( xfer -> c_ata_c . flags & AT_ERROR ) { if ( xfer -> c_ata_c . r_error == WDCE_ABRT ) { error = ENODEV ; goto out ; } } if ( xfer -> c_ata_c . flags & ( AT_ERROR | AT_TIMEOU | AT_DF ) ) { char sbuf [ sizeof ( at_errbits ) + 64 ] ; snprintb ( sbuf , sizeof ( sbuf ) , at_errbits , xfer -> c_ata_c . flags ) ; aprint_error_dev ( wd -> sc_dev , "wd_standby:<S2SV_blank>status=%s\\n" , sbuf ) ; error = EIO ; goto out ; } error = 0 ; out : ata_free_xfer ( wd -> drvp -> chnl_softc , xfer ) ; <S2SV_StartBug> ata_channel_start ( wd -> drvp -> chnl_softc , wd -> drvp -> drive ) ; <S2SV_EndBug> return error ; } | <S2SV_ModStart> xfer ) ; <S2SV_ModEnd> return error ; |
4,676 | CWE-000 int vpx_rb_read_bit ( struct vpx_read_bit_buffer * rb ) { const size_t off = rb -> bit_offset ; const size_t p = off >> 3 ; const int q = 7 - ( int ) ( off & 0x7 ) ; if ( rb -> bit_buffer + p < rb -> bit_buffer_end ) { const int bit = ( rb -> bit_buffer [ p ] >> q ) & 1 ; rb -> bit_offset = off + 1 ; return bit ; } else { <S2SV_StartBug> rb -> error_handler ( rb -> error_handler_data ) ; <S2SV_EndBug> return 0 ; } } | <S2SV_ModStart> } else { if ( rb -> error_handler != NULL ) |
4,677 | CWE-000 bool status_exists ( struct view * view , struct status * status , enum line_type type ) { unsigned long lineno ; refresh_view ( view ) ; for ( lineno = 0 ; lineno < view -> lines ; lineno ++ ) { struct line * line = & view -> line [ lineno ] ; struct status * pos = line -> data ; if ( line -> type != type ) continue ; if ( ( ! pos && ( ! status || ! status -> status ) && line [ 1 ] . data ) || <S2SV_StartBug> ( pos && ! strcmp ( status -> new . name , pos -> new . name ) ) ) { <S2SV_EndBug> select_view_line ( view , lineno ) ; status_restore ( view ) ; return true ; } } return false ; } | <S2SV_ModStart> ( pos && status && |
4,678 | CWE-000 static int hammer2_strategy_write ( struct vop_strategy_args * ap ) { hammer2_xop_strategy_t * xop ; hammer2_pfs_t * pmp ; struct bio * bio ; struct buf * bp ; hammer2_inode_t * ip ; bio = ap -> a_bio ; bp = bio -> bio_buf ; ip = VTOI ( ap -> a_vp ) ; <S2SV_StartBug> pmp = ip -> pmp ; <S2SV_EndBug> hammer2_lwinprog_ref ( pmp ) ; hammer2_trans_assert_strategy ( pmp ) ; hammer2_trans_init ( pmp , HAMMER2_TRANS_BUFCACHE ) ; xop = hammer2_xop_alloc ( ip , HAMMER2_XOP_MODIFYING | HAMMER2_XOP_STRATEGY ) ; xop -> finished = 0 ; xop -> bio = bio ; xop -> lbase = bio -> bio_offset ; hammer2_mtx_init ( & xop -> lock , "h2biow" ) ; hammer2_xop_start ( & xop -> head , hammer2_strategy_xop_write ) ; hammer2_lwinprog_wait ( pmp , hammer2_flush_pipe ) ; return ( 0 ) ; } | <S2SV_ModStart> ip -> pmp ; atomic_set_int ( & ip -> flags , HAMMER2_INODE_DIRTYDATA ) |
4,679 | CWE-000 static int mdp3_iommu_map_iommu ( struct mdp3_iommu_meta * meta , unsigned long align , unsigned long iova_length , unsigned int padding , unsigned long flags ) { struct iommu_domain * domain ; int ret = 0 ; unsigned long size ; unsigned long unmap_size ; struct sg_table * table ; int prot = IOMMU_WRITE | IOMMU_READ ; unsigned int domain_num = ( mdp3_res -> domains + MDP3_IOMMU_DOMAIN_UNSECURE ) -> domain_idx ; unsigned int partition_num = 0 ; size = meta -> size ; table = meta -> table ; if ( sg_dma_len ( table -> sgl ) > align ) align = sg_dma_len ( table -> sgl ) ; ret = msm_allocate_iova_address ( domain_num , partition_num , meta -> mapped_size , align , ( unsigned long * ) & meta -> iova_addr ) ; if ( ret ) goto out ; domain = msm_get_iommu_domain ( domain_num ) ; if ( ! domain ) { ret = - ENOMEM ; goto out1 ; } if ( padding ) { unsigned long phys_addr = sg_phys ( table -> sgl ) ; ret = msm_iommu_map_extra ( domain , meta -> iova_addr , phys_addr , padding , SZ_4K , prot ) ; if ( ret ) goto out1 ; } ret = iommu_map_range ( domain , meta -> iova_addr + padding , table -> sgl , size , prot ) ; if ( ret ) { <S2SV_StartBug> pr_err ( "%s:<S2SV_blank>could<S2SV_blank>not<S2SV_blank>map<S2SV_blank>%pa<S2SV_blank>in<S2SV_blank>domain<S2SV_blank>%p\\n" , <S2SV_EndBug> __func__ , & meta -> iova_addr , domain ) ; unmap_size = padding ; goto out2 ; } if ( padding ) { unsigned long phys_addr = sg_phys ( table -> sgl ) ; unsigned long extra_iova_addr = meta -> iova_addr + padding + size ; ret = msm_iommu_map_extra ( domain , extra_iova_addr , phys_addr , padding , SZ_4K , prot ) ; if ( ret ) { unmap_size = padding + size ; goto out2 ; } } return ret ; out2 : iommu_unmap_range ( domain , meta -> iova_addr , unmap_size ) ; out1 : msm_free_iova_address ( meta -> iova_addr , domain_num , partition_num , iova_length ) ; out : return ret ; } | <S2SV_ModStart> { pr_err ( "%s:<S2SV_blank>could<S2SV_blank>not<S2SV_blank>map<S2SV_blank>%pa<S2SV_blank>in<S2SV_blank>domain<S2SV_blank>%pK\\n" <S2SV_ModEnd> , __func__ , |
4,680 | CWE-000 uint8_t i2cReadDataAck ( ) { <S2SV_StartBug> sbi ( TWCR , TWEA ) ; <S2SV_EndBug> <S2SV_StartBug> return i2cReadData ( ) ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> ( ) { TWCR = ( 1 << TWINT ) | ( 1 << TWEN ) | ( 1 << <S2SV_ModEnd> TWEA ) ; <S2SV_ModStart> TWEA ) ; i2cWait <S2SV_ModEnd> ( ) ; <S2SV_ModStart> ( ) ; return TWDR ; |
4,681 | CWE-000 static void event_exit ( void ) { dr_fprintf ( STDERR , "Saw<S2SV_blank>%s<S2SV_blank>bb<S2SV_blank>events\\n" , num_bbs > 0 ? "some" : "no" ) ; <S2SV_StartBug> dr_fprintf ( STDERR , "Saw<S2SV_blank>%d<S2SV_blank>signal(s)\\n" , num_signals ) ; <S2SV_EndBug> } | <S2SV_ModStart> ( STDERR , "Saw<S2SV_blank>%s<S2SV_blank>signals\\n" , num_signals > 2 ? ">2" : "<=2" <S2SV_ModEnd> ) ; } |
4,682 | CWE-000 int Connect1 ( int interface , int n_ssid , int freq ) { interface ++ ; char ssid [ 128 ] ; if ( n_ssid == 0 ) { strcpy ( ssid , "XIA_Tenda_2" ) ; } else if ( n_ssid == 1 ) { strcpy ( ssid , "XIA-TP-LINK_2.4G" ) ; } else { strcpy ( ssid , "XIA-TP-LINK_5G" ) ; } int rtn ; long begin_time , end_time , total_time ; begin_time = now_msec ( ) ; <S2SV_StartBug> printf ( "-------------connect<S2SV_blank>begin<S2SV_blank>at<S2SV_blank>%ld<S2SV_blank>\\n" , begin_time ) ; <S2SV_EndBug> rtn = Connect_SSID ( interface , ssid , freq ) ; end_time = now_msec ( ) ; say ( "-------------connect<S2SV_blank>end<S2SV_blank>at<S2SV_blank>%ld<S2SV_blank>\\n" , end_time ) ; total_time = end_time - begin_time ; <S2SV_StartBug> printf ( "-------------connect<S2SV_blank>using<S2SV_blank>time<S2SV_blank>=<S2SV_blank>%ld<S2SV_blank>\\n" , total_time ) ; <S2SV_EndBug> } | <S2SV_ModStart> ( ) ; say <S2SV_ModEnd> ( "-------------connect<S2SV_blank>begin<S2SV_blank>at<S2SV_blank>%ld<S2SV_blank>\\n" , <S2SV_ModStart> - begin_time ; say <S2SV_ModEnd> ( "-------------connect<S2SV_blank>using<S2SV_blank>time<S2SV_blank>=<S2SV_blank>%ld<S2SV_blank>\\n" , |
4,683 | CWE-000 static int nextprev ( TINFO * tinfo , WT_CURSOR * cursor , bool next ) { WT_DECL_RET ; WT_ITEM key , value ; uint64_t keyno ; uint8_t bitfield ; int cmp ; const char * which ; bool incrementing ; keyno = 0 ; which = next ? "WT_CURSOR.next" : "WT_CURSOR.prev" ; switch ( ret = ( next ? cursor -> next ( cursor ) : cursor -> prev ( cursor ) ) ) { case 0 : switch ( g . type ) { case FIX : if ( ( ret = cursor -> get_key ( cursor , & keyno ) ) == 0 && ( ret = cursor -> get_value ( cursor , & bitfield ) ) == 0 ) { value . data = & bitfield ; value . size = 1 ; } break ; case ROW : if ( ( ret = cursor -> get_key ( cursor , & key ) ) == 0 ) ret = cursor -> get_value ( cursor , & value ) ; break ; case VAR : if ( ( ret = cursor -> get_key ( cursor , & keyno ) ) == 0 ) ret = cursor -> get_value ( cursor , & value ) ; break ; } if ( ret != 0 ) <S2SV_StartBug> testutil_die ( ret , "nextprev:<S2SV_blank>get_key/get_value" ) ; <S2SV_EndBug> switch ( g . type ) { case FIX : case VAR : testutil_assertfmt ( ! next || tinfo -> keyno < keyno , "%s<S2SV_blank>returned<S2SV_blank>%" PRIu64 "<S2SV_blank>then<S2SV_blank>%" PRIu64 , which , tinfo -> keyno , keyno ) ; testutil_assertfmt ( next || tinfo -> keyno > keyno , "%s<S2SV_blank>returned<S2SV_blank>%" PRIu64 "<S2SV_blank>then<S2SV_blank>%" PRIu64 , which , tinfo -> keyno , keyno ) ; tinfo -> keyno = keyno ; break ; case ROW : cmp = memcmp ( tinfo -> key -> data , key . data , WT_MIN ( tinfo -> key -> size , key . size ) ) ; incrementing = ( next && ! g . c_reverse ) || ( ! next && g . c_reverse ) ; testutil_assertfmt ( ! incrementing || cmp < 0 || ( cmp == 0 && tinfo -> key -> size < key . size ) , "%s<S2SV_blank>returned<S2SV_blank>{%.*s}<S2SV_blank>then<S2SV_blank>{%.*s}" , which , ( int ) tinfo -> key -> size , tinfo -> key -> data , ( int ) key . size , key . data ) ; testutil_assertfmt ( incrementing || cmp > 0 || ( cmp == 0 && tinfo -> key -> size > key . size ) , "%s<S2SV_blank>returned<S2SV_blank>{%.*s}<S2SV_blank>then<S2SV_blank>{%.*s}" , which , ( int ) tinfo -> key -> size , tinfo -> key -> data , ( int ) key . size , key . data ) ; testutil_check ( __wt_buf_set ( ( WT_SESSION_IMPL * ) cursor -> session , tinfo -> key , key . data , key . size ) ) ; break ; } break ; case WT_NOTFOUND : break ; case WT_ROLLBACK : return ( WT_ROLLBACK ) ; default : testutil_die ( ret , "%s" , which ) ; } # ifdef HAVE_BERKELEY_DB if ( ! SINGLETHREADED ) return ( ret ) ; { WT_ITEM bdb_key , bdb_value ; WT_SESSION * session ; int notfound ; char * p ; session = cursor -> session ; bdb_np ( next , & bdb_key . data , & bdb_key . size , & bdb_value . data , & bdb_value . size , & notfound ) ; if ( notfound_chk ( next ? "nextprev(next)" : "nextprev(prev)" , ret , notfound , keyno ) ) return ( ret ) ; if ( ( g . type == ROW && ( key . size != bdb_key . size || memcmp ( key . data , bdb_key . data , key . size ) != 0 ) ) || ( g . type != ROW && keyno != ( uint64_t ) atoll ( bdb_key . data ) ) ) { fprintf ( stderr , "nextprev:<S2SV_blank>%s<S2SV_blank>KEY<S2SV_blank>mismatch:\\n" , which ) ; goto mismatch ; } if ( value . size != bdb_value . size || memcmp ( value . data , bdb_value . data , value . size ) != 0 ) { fprintf ( stderr , "nextprev:<S2SV_blank>%s<S2SV_blank>VALUE<S2SV_blank>mismatch:\\n" , which ) ; mismatch : if ( g . type == ROW ) { print_item ( "bdb-key" , & bdb_key ) ; print_item ( "<S2SV_blank>wt-key" , & key ) ; } else { if ( ( p = ( char * ) strchr ( bdb_key . data , '.' ) ) != NULL ) * p = '\\0' ; fprintf ( stderr , "\\t%.*s<S2SV_blank>!=<S2SV_blank>%" PRIu64 "\\n" , ( int ) bdb_key . size , ( char * ) bdb_key . data , keyno ) ; } print_item ( "bdb-value" , & bdb_value ) ; print_item ( "<S2SV_blank>wt-value" , & value ) ; testutil_die ( 0 , NULL ) ; } if ( g . logging == LOG_OPS ) switch ( g . type ) { case FIX : ( void ) g . wt_api -> msg_printf ( g . wt_api , session , "%-10s%" PRIu64 "<S2SV_blank>{0x%02x}" , which , keyno , ( ( char * ) value . data ) [ 0 ] ) ; break ; case ROW : ( void ) g . wt_api -> msg_printf ( g . wt_api , session , "%-10s{%.*s},<S2SV_blank>{%.*s}" , which , ( int ) key . size , ( char * ) key . data , ( int ) value . size , ( char * ) value . data ) ; break ; case VAR : ( void ) g . wt_api -> msg_printf ( g . wt_api , session , "%-10s%" PRIu64 "<S2SV_blank>{%.*s}" , which , keyno , ( int ) value . size , ( char * ) value . data ) ; break ; } } # endif return ( ret ) ; } | <S2SV_ModStart> , "nextprev:<S2SV_blank>get_key/get_value" ) ; if ( DATASOURCE ( "lsm" ) ) break |
4,684 | CWE-000 QDF_STATUS cds_decr_active_session ( enum tQDF_ADAPTER_MODE mode , uint8_t session_id ) { hdd_context_t * hdd_ctx ; cds_context_type * cds_ctx ; hdd_adapter_t * sap_adapter ; QDF_STATUS qdf_status ; <S2SV_StartBug> cds_ctx = cds_get_context ( QDF_MODULE_ID_QDF ) ; <S2SV_EndBug> if ( ! cds_ctx ) { cds_err ( "Invalid<S2SV_blank>CDS<S2SV_blank>Context" ) ; return QDF_STATUS_E_INVAL ; } hdd_ctx = cds_get_context ( QDF_MODULE_ID_HDD ) ; if ( ! hdd_ctx ) { cds_err ( "HDD<S2SV_blank>context<S2SV_blank>is<S2SV_blank>NULL" ) ; return QDF_STATUS_E_EMPTY ; } qdf_status = cds_check_conn_with_mode_and_vdev_id ( cds_convert_device_mode_to_qdf_type ( mode ) , session_id ) ; if ( ! QDF_IS_STATUS_SUCCESS ( qdf_status ) ) { cds_err ( "No<S2SV_blank>connection<S2SV_blank>with<S2SV_blank>mode:%d<S2SV_blank>vdev_id:%d" , cds_convert_device_mode_to_qdf_type ( mode ) , session_id ) ; return qdf_status ; } switch ( mode ) { case QDF_STA_MODE : case QDF_P2P_CLIENT_MODE : case QDF_P2P_GO_MODE : case QDF_SAP_MODE : case QDF_IBSS_MODE : if ( hdd_ctx -> no_of_active_sessions [ mode ] ) hdd_ctx -> no_of_active_sessions [ mode ] -- ; break ; default : break ; } cds_debug ( "No.#<S2SV_blank>of<S2SV_blank>active<S2SV_blank>sessions<S2SV_blank>for<S2SV_blank>mode<S2SV_blank>%d<S2SV_blank>=<S2SV_blank>%d" , mode , hdd_ctx -> no_of_active_sessions [ mode ] ) ; cds_decr_connection_count ( session_id ) ; if ( ( cds_mode_specific_connection_count ( CDS_STA_MODE , NULL ) == 1 ) && ( cds_mode_specific_connection_count ( CDS_SAP_MODE , NULL ) == 0 ) && ( cds_mode_specific_connection_count ( CDS_P2P_CLIENT_MODE , NULL ) == 0 ) && ( cds_mode_specific_connection_count ( CDS_P2P_GO_MODE , NULL ) == 0 ) && ( cds_mode_specific_connection_count ( CDS_IBSS_MODE , NULL ) == 0 ) ) { if ( cds_ctx -> hdd_en_lro_in_cc_cb != NULL ) cds_ctx -> hdd_en_lro_in_cc_cb ( hdd_ctx ) ; else cds_warn ( "hdd_enable_lro_in_concurrency<S2SV_blank>NULL!" ) ; } if ( cds_mode_specific_connection_count ( CDS_SAP_MODE , NULL ) == 0 ) { if ( cds_ctx -> hdd_set_rx_mode_rps_cb != NULL ) { sap_adapter = hdd_get_adapter ( hdd_ctx , QDF_SAP_MODE ) ; if ( sap_adapter != NULL ) cds_ctx -> hdd_set_rx_mode_rps_cb ( hdd_ctx , sap_adapter , false ) ; } else { cds_warn ( "hdd_set_rx_mode_rps_cb<S2SV_blank>NULL!" ) ; } } cds_set_tdls_ct_mode ( hdd_ctx ) ; cds_dump_current_concurrency ( ) ; <S2SV_StartBug> return qdf_status ; <S2SV_EndBug> } | <S2SV_ModStart> QDF_STATUS qdf_status ; bool mcc_mode ; <S2SV_ModStart> ( ) ; if ( mode == QDF_STA_MODE || mode == QDF_SAP_MODE ) { qdf_mutex_acquire ( & cds_ctx -> qdf_conc_list_lock ) ; mcc_mode = cds_current_concurrency_is_mcc ( ) ; qdf_mutex_release ( & cds_ctx -> qdf_conc_list_lock ) ; if ( cds_ctx -> hdd_ipa_set_mcc_mode_cb ) cds_ctx -> hdd_ipa_set_mcc_mode_cb ( mcc_mode ) ; } |
4,685 | CWE-000 static Node * preprocess_expression ( PlannerInfo * root , Node * expr , int kind ) { if ( expr == NULL ) return NULL ; if ( root -> hasJoinRTEs && ! ( kind == EXPRKIND_RTFUNC || kind == EXPRKIND_VALUES || kind == EXPRKIND_TABLESAMPLE || kind == EXPRKIND_TABLEFUNC ) ) expr = flatten_join_alias_vars ( root , expr ) ; expr = eval_const_expressions ( root , expr ) ; if ( kind == EXPRKIND_QUAL ) { <S2SV_StartBug> expr = ( Node * ) canonicalize_qual ( ( Expr * ) expr ) ; <S2SV_EndBug> # ifdef OPTIMIZER_DEBUG printf ( "After<S2SV_blank>canonicalize_qual()\\n" ) ; pprint ( expr ) ; # endif } if ( root -> parse -> hasSubLinks ) expr = SS_process_sublinks ( root , expr , ( kind == EXPRKIND_QUAL ) ) ; if ( root -> query_level > 1 ) expr = SS_replace_correlation_vars ( root , expr ) ; if ( kind == EXPRKIND_QUAL ) expr = ( Node * ) make_ands_implicit ( ( Expr * ) expr ) ; return expr ; } | <S2SV_ModStart> * ) expr , false |
4,686 | CWE-000 int osmo_bsc_sigtran_init ( struct llist_head * mscs ) { struct bsc_msc_data * msc ; char msc_name [ 256 ] ; OSMO_ASSERT ( mscs ) ; osmo_ss7_init ( ) ; msc_list = mscs ; llist_for_each_entry ( msc , msc_list , entry ) { snprintf ( msc_name , sizeof ( msc_name ) , "MSC<S2SV_blank>No.:<S2SV_blank>%u" , msc -> nr ) ; LOGP ( DMSC , LOGL_NOTICE , "Initalizing<S2SV_blank>SCCP<S2SV_blank>connection<S2SV_blank>to<S2SV_blank>%s\\n" , msc_name ) ; msc -> msc_con -> sccp = osmo_sccp_simple_client ( NULL , msc_name , msc -> msc_con -> g_calling_addr . pc , OSMO_SS7_ASP_PROT_M3UA , 0 , NULL , M3UA_PORT , "127.0.0.1" ) ; msc -> msc_con -> sccp_user = osmo_sccp_user_bind ( msc -> msc_con -> sccp , msc_name , sccp_sap_up , SCCP_SSN_BSSAP ) ; <S2SV_StartBug> msc -> msc_con -> reset . priv = msc ; <S2SV_EndBug> msc -> msc_con -> reset . cb = osmo_bsc_sigtran_reset_cb ; snprintf ( msc -> msc_con -> reset . name , sizeof ( msc -> msc_con -> reset . name ) , "MSC<S2SV_blank>No.<S2SV_blank>%u" , msc -> nr ) ; a_reset_start ( & msc -> msc_con -> reset ) ; } return 0 ; } | <S2SV_ModStart> msc_con -> reset = a_reset_alloc ( NULL , msc_name , osmo_bsc_sigtran_reset_cb , msc <S2SV_ModEnd> ) ; } |
4,687 | CWE-000 void check_for_messages ( ) { uint8_t message ; uint8_t type ; uint8_t args ; uint8_t continued = 0 ; uint8_t value = 0 ; if ( receive ( ) != 0xFF ) { return ; } while ( 1 ) { message = receive ( ) ; if ( message == 0x00 ) { return ; } if ( continued == 0 ) { type = message & 0xF0 ; args = message & 0x0F ; switch ( type ) { case SET_SETTING : while ( 1 ) { message = receive ( ) ; if ( message == 0b0111000 ) { value /= 10 ; switch ( args ) { case SETTING_LENGTH : case SETTING_ROLL_DOWN_VALUE : default : transmit ( 0b01011111 ) ; value = 0 ; return ; } value = 0 ; return ; } value += message ; } break ; case ROLL_UP : roll_shutter ( length , UP ) ; return ; case ROLL_DOWN : roll_shutter ( length , DOWN ) ; return ; case REPORT : case END_TRANSM : <S2SV_StartBug> break ; <S2SV_EndBug> } } transmit ( 0b01100000 ) ; _delay_ms ( 10 ) ; } } | <S2SV_ModStart> case END_TRANSM : return <S2SV_ModEnd> ; } } |
4,688 | CWE-000 int main ( void ) { setupGPIO ( ) ; setupDAC ( ) ; <S2SV_StartBug> setupTimer ( SAMPLE_PERIOD ) ; <S2SV_EndBug> setupNVIC ( ) ; while ( 1 ) ; return 0 ; } | <S2SV_ModStart> ; setupTimer ( SAMPLE_PERIOD_CYCLES <S2SV_ModEnd> ) ; setupNVIC |
4,689 | CWE-000 void dslink_node_tree_free ( DSLink * link , DSNode * root ) { <S2SV_StartBug> if ( link && link -> _ws && root -> parent && root -> parent -> name ) { <S2SV_EndBug> ref_t * rrid = dslink_map_get ( link -> responder -> list_subs , ( void * ) root -> parent -> path ) ; if ( ! rrid ) { goto cleanup ; } uint32_t * rid = rrid -> data ; json_t * top = json_object ( ) ; uint8_t send = 0 ; if ( top ) { json_t * resps = json_array ( ) ; if ( resps ) { json_object_set_new_nocheck ( top , "responses" , resps ) ; json_t * resp = json_object ( ) ; if ( resp ) { json_array_append_new ( resps , resp ) ; json_object_set_new_nocheck ( resp , "rid" , json_integer ( * rid ) ) ; json_object_set_new_nocheck ( resp , "stream" , json_string_nocheck ( "open" ) ) ; json_t * updates = json_array ( ) ; if ( updates ) { json_object_set_new_nocheck ( resp , "updates" , updates ) ; json_t * update = json_object ( ) ; if ( update ) { json_array_append_new ( updates , update ) ; json_object_set_new_nocheck ( update , "name" , json_string_nocheck ( root -> name ) ) ; json_object_set_new_nocheck ( update , "change" , json_string_nocheck ( "remove" ) ) ; send = 1 ; } } } } if ( send ) { dslink_ws_send_obj ( link -> _ws , top ) ; } json_delete ( top ) ; } } cleanup : dslink_node_tree_free_basic ( link , root ) ; } | <S2SV_ModStart> _ws && root && root |
4,690 | CWE-000 void printLine ( ZlineFile zf , i64 line_no , char * * buf , size_t * buf_size ) { i64 line_len = ZlineFile_line_length ( zf , line_no ) ; if ( line_len < 0 ) { fprintf ( stderr , "Invalid<S2SV_blank>line<S2SV_blank>number:<S2SV_blank>%" PRIi64 "\\n" , line_no ) ; exit ( 1 ) ; } <S2SV_StartBug> if ( * buf_size < line_len ) { <S2SV_EndBug> <S2SV_StartBug> * buf_size = MAX ( * buf_size * 2 , line_len ) ; <S2SV_EndBug> free ( * buf ) ; * buf = ( char * ) malloc ( * buf_size ) ; } ZlineFile_get_line2 ( zf , line_no , * buf , * buf_size , 0 ) ; puts ( * buf ) ; } | <S2SV_ModStart> buf_size < line_len + 1 <S2SV_ModStart> 2 , line_len + 1 |
4,691 | CWE-000 int swConnection_onSendfile ( swConnection * conn , swBuffer_trunk * chunk ) { int ret ; swTask_sendfile * task = chunk -> store . ptr ; # ifdef HAVE_TCP_NOPUSH if ( task -> offset == 0 && conn -> tcp_nopush == 0 ) { if ( conn -> tcp_nodelay ) { int tcp_nodelay = 0 ; if ( setsockopt ( conn -> fd , IPPROTO_TCP , TCP_NODELAY , ( const void * ) & tcp_nodelay , sizeof ( int ) ) == - 1 ) { swWarn ( "setsockopt(TCP_NODELAY)<S2SV_blank>failed.<S2SV_blank>Error:<S2SV_blank>%s[%d]" , strerror ( errno ) , errno ) ; } } if ( swSocket_tcp_nopush ( conn -> fd , 1 ) == - 1 ) { swWarn ( "swSocket_tcp_nopush()<S2SV_blank>failed.<S2SV_blank>Error:<S2SV_blank>%s[%d]" , strerror ( errno ) , errno ) ; } conn -> tcp_nopush = 1 ; } # endif int sendn = ( task -> length - task -> offset > SW_SENDFILE_CHUNK_SIZE ) ? SW_SENDFILE_CHUNK_SIZE : task -> length - task -> offset ; # ifdef SW_USE_OPENSSL if ( conn -> ssl ) { ret = swSSL_sendfile ( conn , task -> fd , & task -> offset , sendn ) ; } else # endif { ret = swoole_sendfile ( conn -> fd , task -> fd , & task -> offset , sendn ) ; } swTrace ( "ret=%d|task->offset=%ld|sendn=%d|filesize=%ld" , ret , task -> offset , sendn , task -> length ) ; if ( ret <= 0 ) { switch ( swConnection_error ( errno ) ) { case SW_ERROR : swSysError ( "sendfile(%s,<S2SV_blank>%ld,<S2SV_blank>%d)<S2SV_blank>failed." , task -> filename , task -> offset , sendn ) ; swBuffer_pop_trunk ( conn -> out_buffer , chunk ) ; return SW_OK ; case SW_CLOSE : conn -> close_wait = 1 ; return SW_ERR ; <S2SV_StartBug> default : <S2SV_EndBug> break ; } } if ( task -> offset >= task -> length ) { swBuffer_pop_trunk ( conn -> out_buffer , chunk ) ; # ifdef HAVE_TCP_NOPUSH if ( swSocket_tcp_nopush ( conn -> fd , 0 ) == - 1 ) { swWarn ( "swSocket_tcp_nopush()<S2SV_blank>failed.<S2SV_blank>Error:<S2SV_blank>%s[%d]" , strerror ( errno ) , errno ) ; } conn -> tcp_nopush = 0 ; if ( conn -> tcp_nodelay ) { int value = 1 ; if ( setsockopt ( conn -> fd , IPPROTO_TCP , TCP_NODELAY , ( const void * ) & value , sizeof ( int ) ) == - 1 ) { swWarn ( "setsockopt(TCP_NODELAY)<S2SV_blank>failed.<S2SV_blank>Error:<S2SV_blank>%s[%d]" , strerror ( errno ) , errno ) ; } } # endif } return SW_OK ; } | <S2SV_ModStart> return SW_ERR ; case SW_WAIT : conn -> send_wait = 1 ; return SW_ERR ; |
4,692 | CWE-000 <S2SV_StartBug> draw_dict * heatmap_nonLRU ( READER * reader , struct_cache * cache , char mode , long time_interval , int plot_type , int num_of_threads ) { <S2SV_EndBug> if ( plot_type == hit_rate_start_time_end_time ) { <S2SV_StartBug> return heatmap_hit_rate_start_time_end_time ( reader , cache , mode , time_interval , plot_type , num_of_threads ) ; <S2SV_EndBug> } else if ( plot_type == hit_rate_start_time_cache_size ) { } else if ( plot_type == avg_rd_start_time_end_time ) { } else if ( plot_type == cold_miss_count_start_time_end_time ) { } else if ( plot_type == hit_rate_start_time_cache_size ) { } else { printf ( "unknown<S2SV_blank>plot<S2SV_blank>type\\n" ) ; exit ( 1 ) ; } return NULL ; } | <S2SV_ModStart> , char mode <S2SV_ModEnd> , int plot_type <S2SV_ModStart> cache , mode <S2SV_ModEnd> , plot_type , |
4,693 | CWE-000 int main ( int argc , char * * argv ) { printf ( "rivr<S2SV_blank>is<S2SV_blank>running\\n" ) ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> } | <S2SV_ModStart> "rivr<S2SV_blank>is<S2SV_blank>running\\n" ) ; Register_File rfile ; init_Register_File ( & rfile ) ; Operation halt_op = encode_operation ( I_HALT , 0x0 ) ; const byte * mprog = ( const byte * ) & ( halt_op . bytes ) ; Thread thread ; init_Thread ( & thread , & rfile , mprog , 2 , 0 ) ; run_thread ( & thread ) ; printf ( "Successful<S2SV_blank>exit\\n" ) ; |
4,694 | CWE-000 void amdgpu_dm_connector_funcs_reset ( struct drm_connector * connector ) { struct dm_connector_state * state = to_dm_connector_state ( connector -> state ) ; if ( connector -> state ) __drm_atomic_helper_connector_destroy_state ( connector -> state ) ; kfree ( state ) ; state = kzalloc ( sizeof ( * state ) , GFP_KERNEL ) ; if ( state ) { state -> scaling = RMX_OFF ; state -> underscan_enable = false ; state -> underscan_hborder = 0 ; state -> underscan_vborder = 0 ; <S2SV_StartBug> __drm_atomic_helper_connector_reset ( connector , & state -> base ) ; <S2SV_EndBug> } } | <S2SV_ModStart> = 0 ; state -> max_bpc = 8 ; |
4,695 | CWE-000 int dirtree_recurse ( struct dirtree * node , <S2SV_StartBug> int ( * callback ) ( struct dirtree * node ) , int flags ) <S2SV_EndBug> { struct dirtree * new , * * ddt = & ( node -> child ) ; struct dirent * entry ; <S2SV_StartBug> DIR * dir ; <S2SV_EndBug> if ( node -> dirfd == - 1 || ! ( dir = fdopendir ( node -> dirfd ) ) ) { if ( ! ( flags & DIRTREE_SHUTUP ) ) { char * path = dirtree_path ( node , 0 ) ; perror_msg ( "No<S2SV_blank>%s" , path ) ; free ( path ) ; } close ( node -> dirfd ) ; return flags ; } while ( ( entry = readdir ( dir ) ) ) { if ( ! ( new = dirtree_add_node ( node , entry -> d_name , flags ) ) ) continue ; new = dirtree_handle_callback ( new , callback ) ; if ( new == DIRTREE_ABORTVAL ) break ; if ( new ) { * ddt = new ; ddt = & ( ( * ddt ) -> next ) ; } } if ( flags & DIRTREE_COMEAGAIN ) { node -> again ++ ; flags = callback ( node ) ; } closedir ( dir ) ; node -> dirfd = - 1 ; return flags ; } | <S2SV_ModStart> ) , int dirfd , int <S2SV_ModStart> DIR * dir ; node -> dirfd = dirfd |
4,696 | CWE-000 static void intel_lvds_destroy ( struct drm_connector * connector ) { struct intel_lvds_connector * lvds_connector = <S2SV_StartBug> to_lvds_connector ( connector ) ; <S2SV_EndBug> if ( lvds_connector -> lid_notifier . notifier_call ) acpi_lid_notifier_unregister ( & lvds_connector -> lid_notifier ) ; if ( ! IS_ERR_OR_NULL ( lvds_connector -> base . edid ) ) kfree ( lvds_connector -> base . edid ) ; intel_panel_fini ( & lvds_connector -> base . panel ) ; drm_connector_cleanup ( connector ) ; kfree ( connector ) ; } | <S2SV_ModStart> to_lvds_connector ( connector <S2SV_ModEnd> ) ; if |
4,697 | CWE-000 OCEntityHandlerResult NSEntityHandlerSyncCb ( OCEntityHandlerFlag flag , OCEntityHandlerRequest * entityHandlerRequest , void * callback ) { NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>IN" ) ; OCEntityHandlerResult ehResult = OC_EH_ERROR ; char * reqInterface = NULL ; OCRepPayload * payload = NULL ; ( void ) callback ; if ( ! entityHandlerRequest ) { NS_LOG ( ERROR , "Invalid<S2SV_blank>request<S2SV_blank>pointer" ) ; return ehResult ; } if ( flag & OC_REQUEST_FLAG ) { NS_LOG ( DEBUG , "Flag<S2SV_blank>includes<S2SV_blank>OC_REQUEST_FLAG" ) ; if ( OC_REST_GET == entityHandlerRequest -> method ) { char * copyQuery = OICStrdup ( entityHandlerRequest -> query ) ; reqInterface = OICStrdup ( NSGetValueFromQuery ( copyQuery , NS_QUERY_INTERFACE ) ) ; OICFree ( copyQuery ) ; if ( reqInterface && strcmp ( reqInterface , NS_INTERFACE_BASELINE ) != 0 && strcmp ( reqInterface , NS_INTERFACE_READWRITE ) != 0 ) { NS_LOG ( ERROR , "Invalid<S2SV_blank>interface" ) ; <S2SV_StartBug> return ehResult ; <S2SV_EndBug> } ehResult = OC_EH_OK ; } else if ( OC_REST_POST == entityHandlerRequest -> method ) { NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>OC_REST_POST" ) ; if ( NSProviderIsSyncAttributes ( ( OCRepPayload * ) entityHandlerRequest -> payload ) ) { NSPushQueue ( NOTIFICATION_SCHEDULER , TASK_RECV_READ , NSGetSyncInfo ( entityHandlerRequest -> payload ) ) ; ehResult = OC_EH_OK ; } } else { NS_LOG_V ( DEBUG , "Received<S2SV_blank>method<S2SV_blank>%d<S2SV_blank>from<S2SV_blank>client" , entityHandlerRequest -> method ) ; } } if ( flag & OC_OBSERVE_FLAG ) { NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>OC_OBSERVE_FLAG" ) ; OCObserveAction ocObAction = entityHandlerRequest -> obsInfo . action ; if ( ocObAction == OC_OBSERVE_REGISTER ) { NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>OC_OBSERVE_REGISTER" ) ; NS_LOG_V ( DEBUG , "NSEntityHandlerSyncCb\\n<S2SV_blank>-<S2SV_blank>" "Register<S2SV_blank>Sync<S2SV_blank>observerID<S2SV_blank>:<S2SV_blank>%d\\n" , entityHandlerRequest -> obsInfo . obsId ) ; NSPushQueue ( SUBSCRIPTION_SCHEDULER , TASK_SYNC_SUBSCRIPTION , NSCopyOCEntityHandlerRequest ( entityHandlerRequest ) ) ; } else if ( ocObAction == OC_OBSERVE_DEREGISTER ) { NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>OC_OBSERVE_DEREGISTER" ) ; NS_LOG_V ( DEBUG , "NSEntityHandlerSyncCb\\n<S2SV_blank>-<S2SV_blank>" "Deregister<S2SV_blank>Sync<S2SV_blank>observerID<S2SV_blank>:<S2SV_blank>%d\\n" , entityHandlerRequest -> obsInfo . obsId ) ; NSPushQueue ( SUBSCRIPTION_SCHEDULER , TASK_RECV_UNSUBSCRIPTION , NSCopyOCEntityHandlerRequest ( entityHandlerRequest ) ) ; } } NS_LOG ( DEBUG , "NSEntityHandlerSyncCb<S2SV_blank>-<S2SV_blank>OUT" ) ; ehResult = NSProviderSendResponse ( entityHandlerRequest , payload , reqInterface , ehResult , NS_INTERFACE_TYPE_READ , NS_RESOURCE_MESSAGE ) ; OICFree ( reqInterface ) ; return ehResult ; } | <S2SV_ModStart> "Invalid<S2SV_blank>interface" ) ; NSOICFree ( reqInterface ) ; |
4,698 | CWE-000 static void insert_key_hashed ( struct hash_map * table , uint32_t hash_key , void * key , void * val ) { <S2SV_StartBug> uint32_t index ; <S2SV_EndBug> for ( uint32_t i = 0 ; i < table -> size ; ++ i ) { index = p ( hash_key , i , table -> size ) ; struct bin * bin = & table -> table [ index ] ; if ( bin -> is_free ) { bin -> hash_key = hash_key ; bin -> key = key ; bin -> val = val ; bin -> is_free = bin -> is_deleted = false ; table -> active ++ ; table -> used ++ ; break ; } <S2SV_StartBug> if ( bin -> is_deleted ) { <S2SV_EndBug> bin -> hash_key = hash_key ; bin -> key = key ; bin -> is_free = bin -> is_deleted = false ; table -> active ++ ; break ; } if ( bin -> hash_key == hash_key ) { if ( table -> key_cmp ( bin -> key , key ) ) { table -> key_destructor ( bin -> key ) ; table -> val_destructor ( bin -> val ) ; bin -> key = key ; bin -> val = val ; return ; } else { continue ; } } } } | <S2SV_ModStart> val ) { bool contains = contains_key_hashed ( table , hash_key , key ) ; <S2SV_ModStart> bin -> is_deleted && ! contains |
4,699 | CWE-000 <S2SV_StartBug> void store_set_possible_score ( ) { <S2SV_EndBug> time_t break_freq_seconds = enamel_get_break_freq ( ) * SECONDS_PER_MINUTE ; int diff = e_launch_time - time_start_of_today ( ) - enamel_get_daily_start_time ( ) ; if ( diff <= 0 ) { s_possible_score = 0 ; } else { s_possible_score = diff / break_freq_seconds ; if ( s_possible_score > enamel_get_total_break ( ) ) { s_possible_score = enamel_get_total_break ( ) ; } } } | <S2SV_ModStart> ( ) { APP_LOG ( APP_LOG_LEVEL_INFO , "in<S2SV_blank>store_set_possible_score" ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.