Unnamed: 0
int64 0
535k
| source
stringlengths 50
89.8k
| target
stringlengths 23
37.7k
|
---|---|---|
1,100 | CWE-000 napi_value napiH3ToGeo ( napi_env env , napi_callback_info info ) { napi_value argv [ 1 ] ; size_t argc = 1 ; napi_get_cb_info ( env , info , & argc , argv , NULL , NULL ) ; if ( argc < 1 ) { napi_throw_error ( env , "EINVAL" , "Too<S2SV_blank>few<S2SV_blank>arguments" ) ; return NULL ; } char h3String [ 17 ] ; size_t writeCount ; if ( napi_get_value_string_utf8 ( env , argv [ 0 ] , h3String , 17 , & writeCount ) != napi_ok ) { napi_throw_error ( env , "EINVAL" , "Expected<S2SV_blank>string<S2SV_blank>h3<S2SV_blank>index" ) ; return NULL ; } H3Index h3 = stringToH3 ( h3String ) ; GeoCoord geo = { 0 } ; h3ToGeo ( h3 , & geo ) ; napi_value result ; if ( napi_create_array_with_length ( env , 2 , & result ) != napi_ok ) { <S2SV_StartBug> napi_throw_error ( env , "EINVAL" , "Could<S2SV_blank>not<S2SV_blank>create<S2SV_blank>return<S2SV_blank>array" ) ; <S2SV_EndBug> } napi_value lat ; napi_value lng ; if ( napi_create_double ( env , radsToDegs ( geo . lat ) , & lat ) != napi_ok ) { <S2SV_StartBug> napi_throw_error ( env , "EINVAL" , "Could<S2SV_blank>not<S2SV_blank>write<S2SV_blank>latitude<S2SV_blank>double" ) ; <S2SV_EndBug> } if ( napi_create_double ( env , radsToDegs ( geo . lon ) , & lng ) != napi_ok ) { <S2SV_StartBug> napi_throw_error ( env , "EINVAL" , "Could<S2SV_blank>not<S2SV_blank>write<S2SV_blank>longitude<S2SV_blank>double" ) ; <S2SV_EndBug> } if ( napi_set_element ( env , result , 0 , lat ) != napi_ok ) { <S2SV_StartBug> napi_throw_error ( env , "EINVAL" , "Could<S2SV_blank>not<S2SV_blank>store<S2SV_blank>latitude<S2SV_blank>in<S2SV_blank>array" ) ; <S2SV_EndBug> } if ( napi_set_element ( env , result , 1 , lng ) != napi_ok ) { <S2SV_StartBug> napi_throw_error ( env , "EINVAL" , "Could<S2SV_blank>not<S2SV_blank>store<S2SV_blank>longitude<S2SV_blank>in<S2SV_blank>array" ) ; <S2SV_EndBug> } return result ; } | <S2SV_ModStart> ( env , "ENOSPC" <S2SV_ModEnd> , "Could<S2SV_blank>not<S2SV_blank>create<S2SV_blank>return<S2SV_blank>array" ) <S2SV_ModStart> ( env , "ENOSPC" <S2SV_ModEnd> , "Could<S2SV_blank>not<S2SV_blank>write<S2SV_blank>latitude<S2SV_blank>double" ) <S2SV_ModStart> ( env , "ENOSPC" <S2SV_ModEnd> , "Could<S2SV_blank>not<S2SV_blank>write<S2SV_blank>longitude<S2SV_blank>double" ) <S2SV_ModStart> ( env , "ENOSPC" <S2SV_ModEnd> , "Could<S2SV_blank>not<S2SV_blank>store<S2SV_blank>latitude<S2SV_blank>in<S2SV_blank>array" ) <S2SV_ModStart> ( env , "ENOSPC" <S2SV_ModEnd> , "Could<S2SV_blank>not<S2SV_blank>store<S2SV_blank>longitude<S2SV_blank>in<S2SV_blank>array" ) |
1,101 | CWE-000 int bam_index ( int argc , char * argv [ ] ) { int csi = 0 ; int min_shift = BAM_LIDX_SHIFT ; int c , ret ; while ( ( c = getopt ( argc , argv , "bcm:" ) ) >= 0 ) switch ( c ) { case 'b' : csi = 0 ; break ; case 'c' : csi = 1 ; break ; case 'm' : csi = 1 ; min_shift = atoi ( optarg ) ; break ; default : index_usage ( stderr ) ; return 1 ; } if ( optind == argc ) { index_usage ( stdout ) ; return 1 ; } ret = sam_index_build2 ( argv [ optind ] , argv [ optind + 1 ] , csi ? min_shift : 0 ) ; <S2SV_StartBug> if ( ret != 0 ) { <S2SV_EndBug> if ( ret == - 2 ) print_error_errno ( "index" , "failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>\\"%s\\"" , argv [ optind ] ) ; <S2SV_StartBug> else if ( ret == - 3 ) <S2SV_EndBug> print_error ( "index" , "\\"%s\\"<S2SV_blank>is<S2SV_blank>in<S2SV_blank>a<S2SV_blank>format<S2SV_blank>that<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>usefully<S2SV_blank>indexed" , argv [ optind ] ) ; <S2SV_StartBug> else <S2SV_EndBug> <S2SV_StartBug> print_error ( "index" , "\\"%s\\"<S2SV_blank>is<S2SV_blank>corrupted<S2SV_blank>or<S2SV_blank>unsorted" , argv [ optind ] ) ; <S2SV_EndBug> <S2SV_StartBug> return EXIT_FAILURE ; <S2SV_EndBug> } <S2SV_StartBug> return 0 ; <S2SV_EndBug> } | <S2SV_ModStart> 0 ) ; switch ( ret ) { case 0 : return 0 ; case - 2 : <S2SV_ModEnd> print_error_errno ( "index" <S2SV_ModStart> ] ) ; break ; case - 3 : <S2SV_ModEnd> print_error ( "index" <S2SV_ModStart> ] ) ; break ; case - 4 : if ( argv [ optind + 1 ] ) print_error ( "index" , "failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>or<S2SV_blank>write<S2SV_blank>index<S2SV_blank>\\"%s\\"" , argv [ optind + 1 ] ) ; <S2SV_ModStart> ( "index" , "failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>or<S2SV_blank>write<S2SV_blank>index" ) ; break ; default : print_error ( "index" , <S2SV_ModStart> ] ) ; break ; } <S2SV_ModStart> EXIT_FAILURE ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null> |
1,102 | CWE-000 int PrintSPTable ( TFILE * f1 , FILE * f2 , int v , int vs , int swp ) { SP_HEADER h ; SP_RECORD r ; SP_EXTRA rx ; int n , i ; int nb , nh ; float e , a ; nb = 0 ; while ( 1 ) { nh = ReadSPHeader ( f1 , & h , swp ) ; if ( nh == 0 ) break ; fprintf ( f2 , "\\n" ) ; fprintf ( f2 , "NELE\\t=<S2SV_blank>%d\\n" , h . nele ) ; fprintf ( f2 , "NTRANS\\t=<S2SV_blank>%d\\n" , h . ntransitions ) ; fprintf ( f2 , "TYPE\\t=<S2SV_blank>%07d\\n" , h . type ) ; fprintf ( f2 , "IBLK\\t=<S2SV_blank>%d\\n" , h . iblock ) ; fprintf ( f2 , "ICOMP\\t=<S2SV_blank>%s\\n" , h . icomplex ) ; fprintf ( f2 , "FBLK\\t=<S2SV_blank>%d\\n" , h . fblock ) ; fprintf ( f2 , "FCOMP\\t=<S2SV_blank>%s\\n" , h . fcomplex ) ; IDX_RECORD * idx = NULL ; <S2SV_StartBug> if ( vs ) { <S2SV_EndBug> idx = malloc ( sizeof ( IDX_RECORD ) * h . ntransitions ) ; idx [ 0 ] . position = h . position + nh ; for ( i = 0 ; i < h . ntransitions ; i ++ ) { n = ReadSPRecord ( f1 , & r , & rx , swp ) ; if ( n == 0 ) break ; if ( i < h . ntransitions - 1 ) { idx [ i + 1 ] . position = idx [ i ] . position + n ; } idx [ i ] . i0 = r . upper ; idx [ i ] . i1 = r . lower ; } qsort ( idx , h . ntransitions , sizeof ( IDX_RECORD ) , CompIdxRecord ) ; FSEEK ( f1 , h . position + nh , SEEK_SET ) ; } for ( i = 0 ; i < h . ntransitions ; i ++ ) { if ( idx ) { FSEEK ( f1 , idx [ i ] . position , SEEK_SET ) ; } n = ReadSPRecord ( f1 , & r , & rx , swp ) ; if ( n == 0 ) break ; e = r . energy ; if ( v ) e *= HARTREE_EV ; a = r . strength ; if ( iuta ) { fprintf ( f2 , "%6d<S2SV_blank>%6d<S2SV_blank>%13.6E<S2SV_blank>%11.4E<S2SV_blank>%11.4E<S2SV_blank>%11.4E<S2SV_blank>%11.4E\\n" , r . upper , r . lower , e , rx . sdev * HARTREE_EV , a , r . rrate , r . trate ) ; } else { fprintf ( f2 , "%6d<S2SV_blank>%6d<S2SV_blank>%13.6E<S2SV_blank>%11.4E<S2SV_blank>%11.4E<S2SV_blank>%11.4E\\n" , r . upper , r . lower , e , a , r . rrate , r . trate ) ; } } if ( idx ) { free ( idx ) ; FSEEK ( f1 , h . position + nh + h . length , SEEK_SET ) ; } nb += 1 ; } return nb ; } | <S2SV_ModStart> if ( vs && h . ntransitions > 1 |
1,103 | CWE-000 static int _env_array_entry_splitter ( const char * entry , char * name , int name_len , char * value , int value_len ) { char * ptr ; int len ; ptr = xstrchr ( entry , '=' ) ; if ( ptr == NULL ) return 0 ; <S2SV_StartBug> len = ptr - entry ; <S2SV_EndBug> <S2SV_StartBug> if ( len > name_len - 1 ) <S2SV_EndBug> return 0 ; strlcpy ( name , entry , len ) ; <S2SV_StartBug> ptr = ptr + 1 ; <S2SV_EndBug> <S2SV_StartBug> len = strlen ( ptr ) ; <S2SV_EndBug> <S2SV_StartBug> if ( len > value_len - 1 ) <S2SV_EndBug> return 0 ; strlcpy ( value , ptr , len ) ; return 1 ; } | <S2SV_ModStart> ptr - entry + 1 <S2SV_ModStart> len > name_len <S2SV_ModEnd> ) return 0 <S2SV_ModStart> ) ; ptr ++ <S2SV_ModEnd> ; len = <S2SV_ModStart> ( ptr ) + 1 <S2SV_ModStart> len > value_len <S2SV_ModEnd> ) return 0 |
1,104 | CWE-000 void uxr_disconnect_tcp_platform ( struct uxrTCPPlatform * platform ) { ( void ) ( platform ) ; <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> platform ) ; uxr_disconnectTcpArduino ( ) ; |
1,105 | CWE-000 <S2SV_StartBug> static int other_key ( char buffer [ 3 ] , t_autoc * autoc ) <S2SV_EndBug> { <S2SV_StartBug> autoc -> le -> key_no = ( t_kno ) buffer [ 0 ] ; <S2SV_EndBug> process_key ( autoc -> le ) ; return ( 1 ) ; } | <S2SV_ModStart> char buffer [ 8 <S2SV_ModEnd> ] , t_autoc <S2SV_ModStart> -> key_no = get_key_number ( buffer ) <S2SV_ModEnd> ; process_key ( |
1,106 | CWE-000 int vsnprintf_wrapper ( char * buffer , size_t size , const char * format , <S2SV_StartBug> va_list * arg ) { <S2SV_EndBug> errno = 0 ; <S2SV_StartBug> return vsnprintf ( buffer , size , format , * arg ) ; <S2SV_EndBug> } | <S2SV_ModStart> , va_list * orig_list ) { va_list list ; va_copy ( list , * orig_list ) ; <S2SV_ModEnd> errno = 0 <S2SV_ModStart> , format , list <S2SV_ModEnd> ) ; } |
1,107 | CWE-000 clock_t times ( struct tms * buf ) { struct message m ; _syscall ( SYSCALL_TIMES , & m ) ; <S2SV_StartBug> buf -> tms_utime = m . m2_l2 ; <S2SV_EndBug> buf -> tms_stime = m . m2_l3 ; <S2SV_StartBug> return m . m2_l1 ; <S2SV_EndBug> } | <S2SV_ModStart> m ) ; if ( buf ) { <S2SV_ModStart> . m2_l3 ; } |
1,108 | CWE-000 bool find_exists ( slice_pvoid spc , char * value ) { size_t len = spc_len ( spc ) ; for ( int i = 0 ; i < len ; ++ i ) { char * value2 = spc_get ( spc , ( size_t ) i ) ; <S2SV_StartBug> if ( strcpy ( value2 , value ) == 0 ) { <S2SV_EndBug> return true ; } } return false ; } | <S2SV_ModStart> ; if ( strcmp <S2SV_ModEnd> ( value2 , |
1,109 | CWE-000 celix_status_t fw_stopBundle ( framework_pt framework , bundle_pt bundle , bool record ) { celix_status_t status = CELIX_SUCCESS ; bundle_state_e state ; celix_bundle_activator_t * activator = NULL ; bundle_context_t * context = NULL ; bool wasActive = false ; <S2SV_StartBug> long id = 0 ; <S2SV_EndBug> char * error = NULL ; long bndId = celix_bundle_getId ( bundle ) ; fw_bundleEntry_increaseUseCount ( framework , bndId ) ; if ( record ) { status = CELIX_DO_IF ( status , bundle_setPersistentStateInactive ( bundle ) ) ; } status = CELIX_DO_IF ( status , bundle_getState ( bundle , & state ) ) ; if ( status == CELIX_SUCCESS ) { switch ( state ) { case OSGI_FRAMEWORK_BUNDLE_UNKNOWN : status = CELIX_ILLEGAL_STATE ; error = "state<S2SV_blank>is<S2SV_blank>unknown" ; break ; case OSGI_FRAMEWORK_BUNDLE_UNINSTALLED : status = CELIX_ILLEGAL_STATE ; error = "bundle<S2SV_blank>is<S2SV_blank>uninstalled" ; break ; case OSGI_FRAMEWORK_BUNDLE_STARTING : status = CELIX_BUNDLE_EXCEPTION ; error = "bundle<S2SV_blank>is<S2SV_blank>starting" ; break ; case OSGI_FRAMEWORK_BUNDLE_STOPPING : status = CELIX_BUNDLE_EXCEPTION ; error = "bundle<S2SV_blank>is<S2SV_blank>stopping" ; break ; case OSGI_FRAMEWORK_BUNDLE_INSTALLED : case OSGI_FRAMEWORK_BUNDLE_RESOLVED : break ; case OSGI_FRAMEWORK_BUNDLE_ACTIVE : wasActive = true ; break ; } } status = CELIX_DO_IF ( status , framework_setBundleStateAndNotify ( framework , bundle , OSGI_FRAMEWORK_BUNDLE_STOPPING ) ) ; status = CELIX_DO_IF ( status , fw_fireBundleEvent ( framework , OSGI_FRAMEWORK_BUNDLE_EVENT_STOPPING , bundle ) ) ; <S2SV_StartBug> status = CELIX_DO_IF ( status , bundle_getBundleId ( bundle , & id ) ) ; <S2SV_EndBug> if ( status == CELIX_SUCCESS ) { <S2SV_StartBug> if ( wasActive || ( id == 0 ) ) { <S2SV_EndBug> activator = bundle_getActivator ( bundle ) ; status = CELIX_DO_IF ( status , bundle_getContext ( bundle , & context ) ) ; if ( status == CELIX_SUCCESS ) { if ( activator -> stop != NULL ) { status = CELIX_DO_IF ( status , activator -> stop ( activator -> userData , context ) ) ; if ( status == CELIX_SUCCESS ) { dm_dependency_manager_t * mng = celix_bundleContext_getDependencyManager ( context ) ; dependencyManager_removeAllComponents ( mng ) ; } } } if ( status == CELIX_SUCCESS ) { if ( activator -> destroy != NULL ) { status = CELIX_DO_IF ( status , activator -> destroy ( activator -> userData , context ) ) ; } } <S2SV_StartBug> if ( id != 0 ) { <S2SV_EndBug> celix_serviceTracker_syncForContext ( bundle -> context ) ; status = CELIX_DO_IF ( status , serviceRegistry_clearServiceRegistrations ( framework -> registry , bundle ) ) ; if ( status == CELIX_SUCCESS ) { module_pt module = NULL ; const char * symbolicName = NULL ; long id = 0 ; bundle_getCurrentModule ( bundle , & module ) ; module_getSymbolicName ( module , & symbolicName ) ; bundle_getBundleId ( bundle , & id ) ; serviceRegistry_clearReferencesFor ( framework -> registry , bundle ) ; } if ( context != NULL ) { status = CELIX_DO_IF ( status , bundleContext_destroy ( context ) ) ; status = CELIX_DO_IF ( status , bundle_setContext ( bundle , NULL ) ) ; } status = CELIX_DO_IF ( status , framework_setBundleStateAndNotify ( framework , bundle , OSGI_FRAMEWORK_BUNDLE_RESOLVED ) ) ; } } if ( activator != NULL ) { bundle_setActivator ( bundle , NULL ) ; free ( activator ) ; } } fw_bundleEntry_decreaseUseCount ( framework , bndId ) ; if ( status != CELIX_SUCCESS ) { module_pt module = NULL ; const char * symbolicName = NULL ; long id = 0 ; bundle_getCurrentModule ( bundle , & module ) ; module_getSymbolicName ( module , & symbolicName ) ; bundle_getBundleId ( bundle , & id ) ; if ( error != NULL ) { fw_logCode ( framework -> logger , OSGI_FRAMEWORK_LOG_ERROR , status , "Cannot<S2SV_blank>stop<S2SV_blank>bundle:<S2SV_blank>%s<S2SV_blank>[%ld];<S2SV_blank>cause:<S2SV_blank>%s" , symbolicName , id , error ) ; } else { fw_logCode ( framework -> logger , OSGI_FRAMEWORK_LOG_ERROR , status , "Cannot<S2SV_blank>stop<S2SV_blank>bundle:<S2SV_blank>%s<S2SV_blank>[%ld]" , symbolicName , id ) ; } } else { fw_fireBundleEvent ( framework , OSGI_FRAMEWORK_BUNDLE_EVENT_STOPPED , bundle ) ; } celix_serviceTracker_syncForFramework ( framework ) ; return status ; } | <S2SV_ModStart> = false ; <S2SV_ModEnd> char * error <S2SV_ModStart> ) ) ; <S2SV_ModEnd> if ( status <S2SV_ModStart> wasActive || ( bndId <S2SV_ModEnd> == 0 ) <S2SV_ModStart> } if ( bndId > <S2SV_ModEnd> 0 ) { |
1,110 | CWE-000 static int __cam_lrme_ctx_start_dev_in_acquired ( struct cam_context * ctx , struct cam_start_stop_dev_cmd * cmd ) { int rc = 0 ; <S2SV_StartBug> CAM_DBG ( CAM_LRME , "Enter" ) ; <S2SV_EndBug> rc = cam_context_start_dev_to_hw ( ctx , cmd ) ; if ( rc ) { CAM_ERR ( CAM_LRME , "Failed<S2SV_blank>to<S2SV_blank>start" ) ; return rc ; } ctx -> state = CAM_CTX_ACTIVATED ; return rc ; } | <S2SV_ModStart> ( CAM_LRME , "Enter<S2SV_blank>ctx<S2SV_blank>%d" , ctx -> ctx_id <S2SV_ModEnd> ) ; rc |
1,111 | CWE-000 <S2SV_StartBug> int check_completion ( Game game ) { <S2SV_EndBug> int flag = 0 ; <S2SV_StartBug> for ( int j = 0 ; j < strlen ( game . encoded_words ) ; j ++ ) { <S2SV_EndBug> <S2SV_StartBug> if ( game . encoded_words [ j ] == '_' ) { <S2SV_EndBug> counter ++ ; } } if ( counter == 0 ) { flag = 2 ; } <S2SV_StartBug> if ( game . guesses_remaining == 1 && flag != 2 ) { <S2SV_EndBug> flag = 1 ; } <S2SV_StartBug> game . completion_flag = flag ; <S2SV_EndBug> return flag ; } | <S2SV_ModStart> check_completion ( Game * <S2SV_ModStart> strlen ( game -> <S2SV_ModEnd> encoded_words ) ; <S2SV_ModStart> if ( game -> <S2SV_ModEnd> encoded_words [ j <S2SV_ModStart> if ( game -> <S2SV_ModEnd> guesses_remaining == 1 <S2SV_ModStart> ; } game -> <S2SV_ModEnd> completion_flag = flag |
1,112 | CWE-000 void Begin_low_power ( void ) { if ( ( __HAL_TIM_GET_ENABLE ( & htim10 ) == 0 ) && ( __HAL_TIM_GET_ENABLE ( & htim2 ) == 0 ) && ( __HAL_TIM_GET_ENABLE ( & htim4 ) == 0 ) ) { <S2SV_StartBug> if ( ( system_flag_table -> power_status != POWER_SURPORT_SLEEP ) && ( system_flag_table -> power_status != POWER_LRUN_SLEEP ) ) <S2SV_EndBug> SystemClock_Config_msi ( ) ; } # if configUSE_TICKLESS_IDLE == 1 ulTimerCountsForOneTick = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) ; # endif HAL_SuspendTick ( ) ; } | <S2SV_ModStart> ) ) { <S2SV_ModEnd> } # if |
1,113 | CWE-000 void hclgevf_mbx_handler ( struct hclgevf_dev * hdev ) { struct hclgevf_mbx_resp_status * resp ; struct hclge_mbx_pf_to_vf_cmd * req ; struct hclgevf_cmq_ring * crq ; struct hclgevf_desc * desc ; u16 * msg_q ; u16 flag ; u8 * temp ; int i ; resp = & hdev -> mbx_resp ; crq = & hdev -> hw . cmq . crq ; while ( ! hclgevf_cmd_crq_empty ( & hdev -> hw ) ) { desc = & crq -> desc [ crq -> next_to_use ] ; req = ( struct hclge_mbx_pf_to_vf_cmd * ) desc -> data ; flag = le16_to_cpu ( crq -> desc [ crq -> next_to_use ] . flag ) ; if ( unlikely ( ! hnae3_get_bit ( flag , HCLGEVF_CMDQ_RX_OUTVLD_B ) ) ) { dev_warn ( & hdev -> pdev -> dev , "dropped<S2SV_blank>invalid<S2SV_blank>mailbox<S2SV_blank>message,<S2SV_blank>code<S2SV_blank>=<S2SV_blank>%d\\n" , req -> msg [ 0 ] ) ; crq -> desc [ crq -> next_to_use ] . flag = 0 ; hclge_mbx_ring_ptr_move_crq ( crq ) ; continue ; } switch ( req -> msg [ 0 ] ) { case HCLGE_MBX_PF_VF_RESP : if ( resp -> received_resp ) dev_warn ( & hdev -> pdev -> dev , "VF<S2SV_blank>mbx<S2SV_blank>resp<S2SV_blank>flag<S2SV_blank>not<S2SV_blank>clear(%d)\\n" , req -> msg [ 1 ] ) ; resp -> received_resp = true ; resp -> origin_mbx_msg = ( req -> msg [ 1 ] << 16 ) ; resp -> origin_mbx_msg |= req -> msg [ 2 ] ; resp -> resp_status = req -> msg [ 3 ] ; temp = ( u8 * ) & req -> msg [ 4 ] ; for ( i = 0 ; i < HCLGE_MBX_MAX_RESP_DATA_SIZE ; i ++ ) { resp -> additional_info [ i ] = * temp ; temp ++ ; } break ; case HCLGE_MBX_LINK_STAT_CHANGE : case HCLGE_MBX_ASSERTING_RESET : hdev -> mbx_event_pending = true ; if ( hdev -> arq . count >= HCLGE_MBX_MAX_ARQ_MSG_NUM ) { dev_warn ( & hdev -> pdev -> dev , "Async<S2SV_blank>Q<S2SV_blank>full,<S2SV_blank>dropping<S2SV_blank>msg(%d)\\n" , req -> msg [ 1 ] ) ; break ; } msg_q = hdev -> arq . msg_q [ hdev -> arq . tail ] ; <S2SV_StartBug> memcpy ( & msg_q [ 0 ] , req -> msg , HCLGE_MBX_MAX_ARQ_MSG_SIZE ) ; <S2SV_EndBug> hclge_mbx_tail_ptr_move_arq ( hdev -> arq ) ; hdev -> arq . count ++ ; hclgevf_mbx_task_schedule ( hdev ) ; break ; default : dev_err ( & hdev -> pdev -> dev , "VF<S2SV_blank>received<S2SV_blank>unsupported(%d)<S2SV_blank>mbx<S2SV_blank>msg<S2SV_blank>from<S2SV_blank>PF\\n" , req -> msg [ 0 ] ) ; break ; } crq -> desc [ crq -> next_to_use ] . flag = 0 ; hclge_mbx_ring_ptr_move_crq ( crq ) ; } hclgevf_write_dev ( & hdev -> hw , HCLGEVF_NIC_CRQ_HEAD_REG , crq -> next_to_use ) ; } | <S2SV_ModStart> msg , HCLGE_MBX_MAX_ARQ_MSG_SIZE * sizeof ( u16 ) |
1,114 | CWE-000 int ssfs_fwseek ( int fileID , int loc ) { if ( fileID < 0 ) { printf ( "cant<S2SV_blank>be<S2SV_blank>negative" ) ; return - 1 ; } unsigned char * iNodesBuff = calloc ( 14 , _BLOCK_SIZE ) ; INode * iNodesBlocks = ( INode * ) iNodesBuff ; read_blocks ( 6 , 14 , iNodesBlocks ) ; if ( fdTable [ fileID ] . freeBit == 0 ) { printf ( "No<S2SV_blank>open<S2SV_blank>file<S2SV_blank>with<S2SV_blank>that<S2SV_blank>ID" ) ; return - 1 ; } if ( ( fdTable [ fileID ] . writePointer + loc ) > iNodesBlocks [ fdTable [ fileID ] . iNodeNumber ] . size ) { printf ( "Error,<S2SV_blank>trying<S2SV_blank>to<S2SV_blank>read<S2SV_blank>past<S2SV_blank>end<S2SV_blank>of<S2SV_blank>the<S2SV_blank>file" ) ; return - 1 ; } fdTable [ fileID ] . writePointer = loc ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> } | <S2SV_ModStart> = loc ; free ( iNodesBuff ) ; |
1,115 | CWE-000 char parse_argv ( int argc , char * argv [ ] , int * id , struct flags_s * opts ) { int i , j ; char ch ; char * optarg_ptr ; char * args [ 10 ] ; i = j = 0 ; while ( ( ( ch = getopt ( argc , argv , "cg:s:d:l" ) ) != - 1 ) ) { switch ( ch ) { case 'c' : opts -> flags |= opts -> CFLAG ; return ch ; case 'g' : opts -> flags |= opts -> GFLAG ; * id = atoi ( optarg ) ; if ( * id >= MAX_ROWS ) die ( "There\'s<S2SV_blank>not<S2SV_blank>that<S2SV_blank>many<S2SV_blank>records" ) ; return ch ; case 's' : opts -> flags |= opts -> SFLAG ; optarg_ptr = optarg ; args [ 0 ] = optarg_ptr ; while ( ( * optarg_ptr != '\\0' ) ) { if ( * optarg_ptr == '<S2SV_blank>' ) { args [ ++ i ] = ++ optarg_ptr ; } ++ optarg_ptr ; } for ( i = 0 ; i < 3 ; ++ i ) { while ( ( args [ i ] [ j ] != '\\0' ) ) { if ( args [ i ] [ j ] == '<S2SV_blank>' ) args [ i ] [ j ] = '\\0' ; ++ j ; } } * id = atoi ( args [ 0 ] ) ; name = strdup ( args [ 1 ] ) ; email = strdup ( args [ 2 ] ) ; <S2SV_StartBug> if ( * id >= MAX_ROWS ) <S2SV_EndBug> die ( "There\'s<S2SV_blank>not<S2SV_blank>that<S2SV_blank>many<S2SV_blank>records" ) ; return ch ; case 'd' : opts -> flags |= opts -> DFLAG ; * id = atoi ( optarg ) ; if ( * id >= MAX_ROWS ) die ( "There\'s<S2SV_blank>not<S2SV_blank>that<S2SV_blank>many<S2SV_blank>records" ) ; return ch ; case 'l' : opts -> flags |= opts -> LFLAG ; return ch ; default : die ( "Invalid<S2SV_blank>action:<S2SV_blank>c=create," "g=get,<S2SV_blank>s=set,<S2SV_blank>d=del,<S2SV_blank>l=list" ) ; } } return 0 ; } | <S2SV_ModStart> ; if ( strlen ( name ) == MAX_DATA && name [ MAX_DATA ] != '\\0' ) name [ MAX_DATA ] = '\\0' ; if ( strlen ( email ) == MAX_DATA && name [ MAX_DATA ] != '\\0' ) email [ MAX_DATA ] = '\\0' ; if ( |
1,116 | CWE-000 static inline void wd_smp_unlock ( unsigned long * flags ) { clear_bit_unlock ( 0 , & __wd_smp_lock ) ; <S2SV_StartBug> local_irq_restore ( * flags ) ; <S2SV_EndBug> } | <S2SV_ModStart> __wd_smp_lock ) ; raw_local_irq_restore <S2SV_ModEnd> ( * flags |
1,117 | CWE-000 apr_status_t h2_slave_run_pre_connection ( conn_rec * slave , apr_socket_t * csd ) { <S2SV_StartBug> return ap_run_pre_connection ( slave , csd ) ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> csd ) { if ( slave -> keepalives == 0 ) { slave -> keepalives = 1 ; <S2SV_ModStart> ) ; } return APR_SUCCESS ; } |
1,118 | CWE-000 int main ( void ) { <S2SV_StartBug> struct list example ; <S2SV_EndBug> init_list ( & example ) ; <S2SV_StartBug> int x = get_node_value ( get_header ( & example ) ) ; <S2SV_EndBug> printf ( "header<S2SV_blank>x<S2SV_blank>:<S2SV_blank>%d\\n" , x ) ; add ( & example , 5 ) ; add ( & example , 10 ) ; <S2SV_StartBug> find ( & example , 15 ) ; <S2SV_EndBug> <S2SV_StartBug> find ( & example , 2 ) ; <S2SV_EndBug> free_list ( & example ) ; } | <S2SV_ModStart> void ) { printf ( "defdefdwse\\n" ) ; <S2SV_ModStart> struct list example ; printf ( "defdefdwse\\n" ) <S2SV_ModStart> example ) ; printf ( "add\\n" <S2SV_ModEnd> ) ; add <S2SV_ModStart> 10 ) ; add ( & example , 2 ) ; add <S2SV_ModEnd> ( & example <S2SV_ModStart> & example , 10 ) ; printAll ( & example <S2SV_ModEnd> ) ; free_list |
1,119 | CWE-000 int removal ( int argc , char * * argv ) { <S2SV_StartBug> extract ( argc , argv ) ; <S2SV_EndBug> FILE * archive = fopen ( argv [ 1 ] , "r" ) ; struct stat s ; uint8_t buf [ 1024 ] ; for ( int i = 2 ; i < argc ; i ++ ) { while ( ! feof ( archive ) ) { if ( ! fread ( & s . st_size , sizeof ( s . st_size ) , 1 , archive ) ) { break ; } fread ( & s . st_mode , sizeof ( s . st_mode ) , 1 , archive ) ; size_t l ; fread ( & l , sizeof ( size_t ) , 1 , archive ) ; char name [ l + 1 ] ; fread ( name , l , 1 , archive ) ; name [ l ] = 0 ; if ( argv [ 1 ] == name ) break ; while ( s . st_size ) { size_t n = fread ( buf , 1 , s . st_size , archive ) ; s . st_size -= n ; } } if ( feof ( archive ) ) return - 1 ; int countdown = s . st_size ; while ( countdown ) { countdown -= fread ( buf , 1 , s . st_size , archive ) ; } while ( ! feof ( archive ) ) { fread ( buf , 1 , s . st_size , archive ) ; fseek ( archive , - sizeof ( buf ) , SEEK_SET ) ; fwrite ( & buf , sizeof ( buf ) , 1 , archive ) ; fseek ( archive , sizeof ( buf ) , SEEK_SET ) ; } fseek ( archive , 0L , SEEK_END ) ; truncate ( argv [ 1 ] , ftell ( archive ) - s . st_size ) ; rewind ( archive ) ; } fclose ( archive ) ; return 0 ; } | <S2SV_ModStart> argv ) { if ( <S2SV_ModStart> , argv ) != 0 ) { printf ( "Unable<S2SV_blank>to<S2SV_blank>extract<S2SV_blank>for<S2SV_blank>removal.\\n" ) ; return 0 ; } <S2SV_ModEnd> FILE * archive |
1,120 | CWE-000 value stub_float32_ndarray_conv_spatial_native ( value vInput_ptr , value vKernel_ptr , value vOutput_ptr , value vBatches , value vInput_cols , value vInput_rows , value vIn_channel , value vKernel_cols , value vKernel_rows , value vOutput_cols , value vOutput_rows , value vOut_channel , value vRow_stride , value vCol_stride , value vPadding , value vRow_in_stride , value vCol_in_stride ) { struct caml_ba_array * IN = Caml_ba_array_val ( vInput_ptr ) ; struct caml_ba_array * KE = Caml_ba_array_val ( vKernel_ptr ) ; struct caml_ba_array * OU = Caml_ba_array_val ( vOutput_ptr ) ; TYPE * input_ptr = ( TYPE * ) IN -> data ; TYPE * kernel_ptr = ( TYPE * ) KE -> data ; TYPE * output_ptr = ( TYPE * ) OU -> data ; int batches = Long_val ( vBatches ) ; int input_cols = Long_val ( vInput_cols ) ; int input_rows = Long_val ( vInput_rows ) ; int in_channel = Long_val ( vIn_channel ) ; int kernel_cols = Long_val ( vKernel_cols ) ; int kernel_rows = Long_val ( vKernel_rows ) ; int output_cols = Long_val ( vOutput_cols ) ; int output_rows = Long_val ( vOutput_rows ) ; int out_channel = Long_val ( vOut_channel ) ; int row_stride = Long_val ( vRow_stride ) ; int col_stride = Long_val ( vCol_stride ) ; int padding = Long_val ( vPadding ) ; int row_in_stride = Long_val ( vRow_in_stride ) ; int col_in_stride = Long_val ( vCol_in_stride ) ; const int input_cri = in_channel * input_rows * input_cols ; const int input_ri = in_channel * input_rows ; const int kernel_rio = out_channel * in_channel * kernel_rows ; const int kernel_io = out_channel * in_channel ; const int output_cri = out_channel * output_rows * output_cols ; const int output_ri = out_channel * output_rows ; const int ksize = kernel_cols * kernel_rows ; memset ( output_ptr , 0 , batches * output_cri * sizeof ( TYPE ) ) ; int pr = 0 , pc = 0 ; if ( padding != 1 ) { pr = ( row_stride * ( output_rows - 1 ) + kernel_rows - input_rows ) / 2 ; pc = ( col_stride * ( output_cols - 1 ) + kernel_cols - input_cols ) / 2 ; if ( pr < 0 ) pr = 0 ; if ( pc < 0 ) pc = 0 ; } const int output_crb = output_rows * output_cols * batches ; const int output_cr = output_rows * output_cols ; const int kernel_cri = ksize * in_channel ; TYPE * kern2d = ( TYPE * ) calloc ( out_channel * kernel_cri , sizeof ( TYPE * ) ) ; if ( kern2d == NULL ) exit ( 1 ) ; TYPE * inpt2d = ( TYPE * ) calloc ( kernel_cri * output_crb , sizeof ( TYPE * ) ) ; if ( inpt2d == NULL ) exit ( 1 ) ; for ( int i = 0 ; i < output_crb ; ++ i ) { int bt = i / output_cr ; int cr = i % output_cr ; int c = cr / output_rows ; int r = cr % output_rows ; const int cstart = c * col_stride - pc ; const int rstart = r * row_stride - pr ; const int cend = cstart + kernel_cols ; const int rend = rstart + kernel_rows ; int cnt = 0 ; for ( int a = cstart ; a < cend ; ++ a ) { for ( int b = rstart ; b < rend ; ++ b ) { for ( int h = 0 ; h < in_channel ; ++ h ) { if ( a < input_cols && a >= 0 && b < input_rows && b >= 0 ) { int input_idx = bt * input_cri + a * input_ri + b * in_channel + h ; <S2SV_StartBug> inpt2d [ i * kernel_cri + cnt ] = input_ptr [ input_idx ] ; <S2SV_EndBug> printf ( "input:<S2SV_blank>%d,<S2SV_blank>%d<S2SV_blank><--><S2SV_blank>%d\\n" , i , cnt , input_idx ) ; } else { printf ( "input:<S2SV_blank>%d,<S2SV_blank>%d<S2SV_blank><--><S2SV_blank>x\\n" , i , cnt ) ; } cnt ++ ; } } } } for ( int i = 0 ; i < output_crb ; ++ i ) { for ( int j = 0 ; j < kernel_cri ; ++ j ) { printf ( "%.2f<S2SV_blank>" , inpt2d [ i * kernel_cri + j ] ) ; } printf ( "\\n" ) ; } <S2SV_StartBug> int kernel_idx = 0 ; <S2SV_EndBug> for ( int j = 0 ; j < kernel_cri ; ++ j ) { for ( int i = 0 ; i < out_channel ; ++ i ) { kern2d [ i * kernel_cri + j ] = kernel_ptr [ kernel_idx ++ ] ; printf ( "input:<S2SV_blank>%d,<S2SV_blank>%d<S2SV_blank><--><S2SV_blank>%d\\n" , i , j , kernel_idx ) ; } } for ( int i = 0 ; i < out_channel ; ++ i ) { for ( int j = 0 ; j < kernel_cri ; ++ j ) { printf ( "%.2f<S2SV_blank>" , kern2d [ i * kernel_cri + j ] ) ; } printf ( "\\n" ) ; } fflush ( stdout ) ; cblas_sgemm ( CblasColMajor , CblasNoTrans , CblasTrans , out_channel , output_crb , kernel_cri , 1 , kern2d , out_channel , inpt2d , output_crb , 0 , output_ptr , out_channel ) ; free ( inpt2d ) ; free ( kern2d ) ; return Val_unit ; } | <S2SV_ModStart> ; inpt2d [ cnt * output_crb + i <S2SV_ModEnd> ] = input_ptr <S2SV_ModStart> ) ; } fflush ( stdout ) ; cblas_sgemm ( CblasColMajor , CblasNoTrans , CblasTrans , out_channel , output_crb , kernel_cri , 1 , kernel_ptr <S2SV_ModEnd> , out_channel , |
1,121 | CWE-000 void update_vsyscall ( struct timekeeper * tk ) { struct timespec64 * wtm = & tk -> wall_to_monotonic ; if ( ! cntvct_ok ) { return ; } vdso_write_begin ( vdso_data ) ; vdso_data -> use_syscall = ! tk_is_cntvct ( tk ) ; vdso_data -> xtime_coarse_sec = tk -> xtime_sec ; vdso_data -> xtime_coarse_nsec = ( u32 ) ( tk -> tkr_mono . xtime_nsec >> tk -> tkr_mono . shift ) ; vdso_data -> wtm_clock_sec = wtm -> tv_sec ; vdso_data -> wtm_clock_nsec = wtm -> tv_nsec ; if ( ! vdso_data -> use_syscall ) { <S2SV_StartBug> vdso_data -> cs_cycle_last = tk -> tkr_mono . cycle_last ; <S2SV_EndBug> vdso_data -> raw_time_sec = tk -> raw_sec ; vdso_data -> raw_time_nsec = tk -> tkr_raw . xtime_nsec ; vdso_data -> xtime_clock_sec = tk -> xtime_sec ; vdso_data -> xtime_clock_snsec = tk -> tkr_mono . xtime_nsec ; vdso_data -> cs_mono_mult = tk -> tkr_mono . mult ; vdso_data -> cs_raw_mult = tk -> tkr_raw . mult ; vdso_data -> cs_shift = tk -> tkr_mono . shift ; vdso_data -> cs_mask = tk -> tkr_mono . mask ; <S2SV_StartBug> vdso_data -> btm_nsec = ktime_to_ns ( tk -> offs_boot ) ; <S2SV_EndBug> } vdso_write_end ( vdso_data ) ; flush_dcache_page ( virt_to_page ( vdso_data ) ) ; } | <S2SV_ModStart> use_syscall ) { struct timespec btm = ktime_to_timespec ( tk -> offs_boot ) ; <S2SV_ModStart> ; vdso_data -> btm_sec = btm . tv_sec ; vdso_data -> btm_nsec = btm . tv_nsec <S2SV_ModEnd> ; } vdso_write_end |
1,122 | CWE-000 static client_info * add_client ( int fd ) { client_info * client ; for ( client = clients ; client < clients + MAX_CLIENT_NUMBER && client -> state != STATE_NONE ; client ++ ) ; <S2SV_StartBug> check1 ( ! ( client < clients + MAX_CLIENT_NUMBER ) , "No<S2SV_blank>free<S2SV_blank>client<S2SV_blank>slots" ) ; <S2SV_EndBug> log_info ( "Adding<S2SV_blank>client<S2SV_blank>no<S2SV_blank>%u" , ( unsigned ) ( clients - client ) ) ; client -> fd = fd ; client -> state = STATE_CONNECTING ; client -> read_status = READ_STATUS_DEFAULT ; client -> retries = 0 ; return client ; error : return 0 ; } | <S2SV_ModStart> ; check1 ( <S2SV_ModEnd> ( client < |
1,123 | CWE-000 static int transfer_max_buffers ( struct goldfish_pipe * pipe , unsigned long address , unsigned long address_end , int is_write , unsigned long last_page , unsigned int last_page_size , s32 * consumed_size , int * status ) { struct page * pages [ MAX_BUFFERS_PER_COMMAND ] ; unsigned long first_page = address & PAGE_MASK ; unsigned int iter_last_page_size ; int pages_count = pin_user_pages ( first_page , last_page , last_page_size , is_write , pages , & iter_last_page_size ) ; if ( pages_count < 0 ) return pages_count ; if ( mutex_lock_interruptible ( & pipe -> lock ) ) return - ERESTARTSYS ; populate_rw_params ( pages , pages_count , address , address_end , first_page , last_page , iter_last_page_size , is_write , pipe -> command_buffer ) ; <S2SV_StartBug> * status = goldfish_cmd_locked ( <S2SV_EndBug> pipe , is_write ? PIPE_CMD_WRITE : PIPE_CMD_READ ) ; * consumed_size = pipe -> command_buffer -> rw_params . consumed_size ; mutex_unlock ( & pipe -> lock ) ; release_user_pages ( pages , pages_count , is_write , * consumed_size ) ; return 0 ; } | <S2SV_ModStart> * status = goldfish_pipe_cmd_locked <S2SV_ModEnd> ( pipe , |
1,124 | CWE-000 static int initializeModules ( ) { int err = 0 ; printf ( PRINTF_MODULE "Notice:<S2SV_blank>Initializing<S2SV_blank>modules\\n" ) ; ( void ) fflush ( stdout ) ; err |= control_init ( ) ; err |= network_init ( ) ; err |= audio_init ( ) ; <S2SV_StartBug> # ifndef MP_DESKTOP <S2SV_EndBug> err |= disp_init ( ) ; <S2SV_StartBug> # endif <S2SV_EndBug> return err ; } | <S2SV_ModStart> ( ) ; <S2SV_ModEnd> err |= disp_init <S2SV_ModStart> ( ) ; <S2SV_ModEnd> return err ; |
1,125 | CWE-000 static int sensor_queryctrl ( struct v4l2_subdev * sd , struct v4l2_queryctrl * qc ) { vfe_dev_dbg ( "sensor_queryctrl:<S2SV_blank>%x\\n" , qc -> id ) ; switch ( qc -> id ) { case V4L2_CID_BRIGHTNESS : return v4l2_ctrl_query_fill ( qc , - 4 , 4 , 1 , 1 ) ; case V4L2_CID_CONTRAST : return v4l2_ctrl_query_fill ( qc , - 4 , 4 , 1 , 1 ) ; case V4L2_CID_SATURATION : return v4l2_ctrl_query_fill ( qc , - 4 , 4 , 1 , 1 ) ; case V4L2_CID_HUE : return v4l2_ctrl_query_fill ( qc , - 180 , 180 , 5 , 0 ) ; case V4L2_CID_VFLIP : <S2SV_StartBug> case V4L2_CID_HFLIP : <S2SV_EndBug> return v4l2_ctrl_query_fill ( qc , 0 , 1 , 1 , 0 ) ; case V4L2_CID_GAIN : return v4l2_ctrl_query_fill ( qc , 0 , 255 , 1 , 128 ) ; case V4L2_CID_AUTOGAIN : return v4l2_ctrl_query_fill ( qc , 0 , 1 , 1 , 1 ) ; case V4L2_CID_EXPOSURE : case V4L2_CID_AUTO_EXPOSURE_BIAS : return v4l2_ctrl_query_fill ( qc , - 4 , 4 , 1 , 0 ) ; case V4L2_CID_EXPOSURE_AUTO : return v4l2_ctrl_query_fill ( qc , 0 , 3 , 1 , 0 ) ; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE : return v4l2_ctrl_query_fill ( qc , 0 , 9 , 1 , 1 ) ; case V4L2_CID_AUTO_WHITE_BALANCE : return v4l2_ctrl_query_fill ( qc , 0 , 1 , 1 , 1 ) ; case V4L2_CID_COLORFX : return v4l2_ctrl_query_fill ( qc , 0 , 15 , 1 , 0 ) ; case V4L2_CID_FLASH_LED_MODE : return v4l2_ctrl_query_fill ( qc , 0 , 4 , 1 , 0 ) ; case V4L2_CID_POWER_LINE_FREQUENCY : return v4l2_ctrl_query_fill ( qc , 0 , 3 , 1 , 0 ) ; case V4L2_CID_SHARPNESS : return v4l2_ctrl_query_fill ( qc , 0 , 200 , 100 , 0 ) ; case V4L2_CID_FRAME_RATE : return v4l2_ctrl_query_fill ( qc , FRAME_RATE_AUTO , FRAME_RATE_30 , 1 , FRAME_RATE_AUTO ) ; case V4L2_CID_3A_LOCK : return v4l2_ctrl_query_fill ( qc , 0 , V4L2_LOCK_FOCUS , 1 , 0 ) ; case V4L2_CID_AUTO_FOCUS_INIT : case V4L2_CID_AUTO_FOCUS_RELEASE : case V4L2_CID_AUTO_FOCUS_START : case V4L2_CID_AUTO_FOCUS_STOP : case V4L2_CID_AUTO_FOCUS_STATUS : return v4l2_ctrl_query_fill ( qc , 0 , 0 , 0 , 0 ) ; case V4L2_CID_FOCUS_AUTO : return v4l2_ctrl_query_fill ( qc , 0 , 1 , 1 , 0 ) ; } vfe_dev_dbg ( "sensor_queryctrl:<S2SV_blank>%x<S2SV_blank>***<S2SV_blank>EINVAL<S2SV_blank>***\\n" , qc -> id ) ; return - EINVAL ; } | <S2SV_ModStart> case V4L2_CID_VFLIP : return v4l2_ctrl_query_fill ( qc , 0 , 1 , 1 , 1 ) ; |
1,126 | CWE-000 static int omap_kp_probe ( struct platform_device * pdev ) { struct omap_kp * omap_kp ; struct input_dev * input_dev ; struct omap_kp_platform_data * pdata = dev_get_platdata ( & pdev -> dev ) ; int i , col_idx , row_idx , ret ; unsigned int row_shift , keycodemax ; if ( ! pdata -> rows || ! pdata -> cols || ! pdata -> keymap_data ) { printk ( KERN_ERR "No<S2SV_blank>rows,<S2SV_blank>cols<S2SV_blank>or<S2SV_blank>keymap_data<S2SV_blank>from<S2SV_blank>pdata\\n" ) ; return - EINVAL ; } row_shift = get_count_order ( pdata -> cols ) ; keycodemax = pdata -> rows << row_shift ; omap_kp = kzalloc ( sizeof ( struct omap_kp ) + keycodemax * sizeof ( unsigned short ) , GFP_KERNEL ) ; input_dev = input_allocate_device ( ) ; if ( ! omap_kp || ! input_dev ) { kfree ( omap_kp ) ; input_free_device ( input_dev ) ; return - ENOMEM ; } platform_set_drvdata ( pdev , omap_kp ) ; omap_kp -> input = input_dev ; omap_writew ( 1 , OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT ) ; if ( pdata -> delay ) omap_kp -> delay = pdata -> delay ; if ( pdata -> row_gpios && pdata -> col_gpios ) { row_gpios = pdata -> row_gpios ; col_gpios = pdata -> col_gpios ; } omap_kp -> rows = pdata -> rows ; omap_kp -> cols = pdata -> cols ; col_idx = 0 ; row_idx = 0 ; setup_timer ( & omap_kp -> timer , omap_kp_timer , ( unsigned long ) omap_kp ) ; <S2SV_StartBug> tasklet_enable ( & kp_tasklet ) ; <S2SV_EndBug> kp_tasklet . data = ( unsigned long ) omap_kp ; <S2SV_StartBug> ret = device_create_file ( & pdev -> dev , & dev_attr_enable ) ; <S2SV_EndBug> if ( ret < 0 ) goto err2 ; input_dev -> name = "omap-keypad" ; input_dev -> phys = "omap-keypad/input0" ; input_dev -> dev . parent = & pdev -> dev ; input_dev -> id . bustype = BUS_HOST ; input_dev -> id . vendor = 0x0001 ; input_dev -> id . product = 0x0001 ; input_dev -> id . version = 0x0100 ; if ( pdata -> rep ) __set_bit ( EV_REP , input_dev -> evbit ) ; ret = matrix_keypad_build_keymap ( pdata -> keymap_data , NULL , pdata -> rows , pdata -> cols , omap_kp -> keymap , input_dev ) ; if ( ret < 0 ) goto err3 ; ret = input_register_device ( omap_kp -> input ) ; if ( ret < 0 ) { printk ( KERN_ERR "Unable<S2SV_blank>to<S2SV_blank>register<S2SV_blank>omap-keypad<S2SV_blank>input<S2SV_blank>device\\n" ) ; goto err3 ; } if ( pdata -> dbounce ) omap_writew ( 0xff , OMAP1_MPUIO_BASE + OMAP_MPUIO_GPIO_DEBOUNCING ) ; omap_kp_scan_keypad ( omap_kp , keypad_state ) ; omap_kp -> irq = platform_get_irq ( pdev , 0 ) ; if ( omap_kp -> irq >= 0 ) { if ( request_irq ( omap_kp -> irq , omap_kp_interrupt , 0 , "omap-keypad" , omap_kp ) < 0 ) goto err4 ; } omap_writew ( 0 , OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT ) ; return 0 ; err4 : input_unregister_device ( omap_kp -> input ) ; input_dev = NULL ; err3 : device_remove_file ( & pdev -> dev , & dev_attr_enable ) ; err2 : for ( i = row_idx - 1 ; i >= 0 ; i -- ) gpio_free ( row_gpios [ i ] ) ; for ( i = col_idx - 1 ; i >= 0 ; i -- ) gpio_free ( col_gpios [ i ] ) ; kfree ( omap_kp ) ; input_free_device ( input_dev ) ; return - EINVAL ; } | <S2SV_ModStart> omap_kp ) ; <S2SV_ModEnd> kp_tasklet . data <S2SV_ModStart> ) omap_kp ; tasklet_enable ( & kp_tasklet ) ; |
1,127 | CWE-000 static int snd_usb_pcm_prepare ( struct snd_pcm_substream * substream ) { struct snd_pcm_runtime * runtime = substream -> runtime ; struct snd_usb_substream * subs = runtime -> private_data ; struct usb_host_interface * alts ; struct usb_interface * iface ; int ret ; if ( ! subs -> cur_audiofmt ) { dev_err ( & subs -> dev -> dev , "no<S2SV_blank>format<S2SV_blank>is<S2SV_blank>specified!\\n" ) ; return - ENXIO ; } ret = snd_usb_lock_shutdown ( subs -> stream -> chip ) ; if ( ret < 0 ) return ret ; if ( snd_BUG_ON ( ! subs -> data_endpoint ) ) { ret = - EIO ; goto unlock ; } snd_usb_endpoint_sync_pending_stop ( subs -> sync_endpoint ) ; snd_usb_endpoint_sync_pending_stop ( subs -> data_endpoint ) ; ret = set_format ( subs , subs -> cur_audiofmt ) ; if ( ret < 0 ) goto unlock ; iface = usb_ifnum_to_if ( subs -> dev , subs -> cur_audiofmt -> iface ) ; alts = & iface -> altsetting [ subs -> cur_audiofmt -> altset_idx ] ; ret = snd_usb_init_sample_rate ( subs -> stream -> chip , subs -> cur_audiofmt -> iface , alts , subs -> cur_audiofmt , subs -> cur_rate ) ; if ( ret < 0 ) goto unlock ; if ( subs -> need_setup_ep ) { ret = configure_endpoint ( subs ) ; if ( ret < 0 ) goto unlock ; subs -> need_setup_ep = false ; } subs -> data_endpoint -> maxframesize = bytes_to_frames ( runtime , subs -> data_endpoint -> maxpacksize ) ; subs -> data_endpoint -> curframesize = bytes_to_frames ( runtime , subs -> data_endpoint -> curpacksize ) ; subs -> hwptr_done = 0 ; subs -> transfer_done = 0 ; subs -> last_delay = 0 ; subs -> last_frame_number = 0 ; runtime -> delay = 0 ; if ( subs -> direction == SNDRV_PCM_STREAM_PLAYBACK ) <S2SV_StartBug> ret = start_endpoints ( subs , true ) ; <S2SV_EndBug> unlock : snd_usb_unlock_shutdown ( subs -> stream -> chip ) ; return ret ; } | <S2SV_ModStart> start_endpoints ( subs <S2SV_ModEnd> ) ; unlock |
1,128 | CWE-000 USER_OBJECT_ S_atk_image_get_image_position ( USER_OBJECT_ s_object , USER_OBJECT_ s_coord_type ) { USER_OBJECT_ _result = NULL_USER_OBJECT ; AtkImage * object = ATK_IMAGE ( getPtrValue ( s_object ) ) ; AtkCoordType coord_type = ( ( AtkCoordType ) asCEnum ( s_coord_type , ATK_TYPE_COORD_TYPE ) ) ; gint x ; gint y ; atk_image_get_image_position ( object , & x , & y , coord_type ) ; <S2SV_StartBug> _result = retByVal ( _result , "x" , asRInteger ( x ) , "y" , asRInteger ( y ) , NULL ) ; <S2SV_EndBug> ; ; return ( _result ) ; } | <S2SV_ModStart> = retByVal ( PROTECT ( _result ) <S2SV_ModEnd> , "x" , <S2SV_ModStart> , "x" , PROTECT ( <S2SV_ModStart> ( x ) ) <S2SV_ModStart> , "y" , PROTECT ( <S2SV_ModStart> ( y ) ) , NULL ) ; UNPROTECT ( 3 <S2SV_ModEnd> ) ; ; |
1,129 | CWE-000 void bptt_updater_destroy ( bptt_updater_t * bptt_updater ) { int i ; if ( bptt_updater == NULL ) { return ; } <S2SV_StartBug> if ( bptt_updater -> ac_bptts != NULL ) { <S2SV_EndBug> for ( i = 1 ; i <= bptt_updater -> num_glue ; i ++ ) { mat_destroy ( bptt_updater -> ac_bptts + i ) ; } safe_st_free ( bptt_updater -> ac_bptts ) ; } if ( bptt_updater -> er_bptts != NULL ) { for ( i = 1 ; i <= bptt_updater -> num_glue ; i ++ ) { mat_destroy ( bptt_updater -> er_bptts + i ) ; } safe_st_free ( bptt_updater -> er_bptts ) ; } if ( bptt_updater -> in_acs != NULL ) { for ( i = 1 ; i <= bptt_updater -> num_glue ; i ++ ) { mat_destroy ( bptt_updater -> in_acs + i ) ; } safe_st_free ( bptt_updater -> in_acs ) ; } if ( bptt_updater -> out_ers != NULL ) { for ( i = 1 ; i <= bptt_updater -> num_glue ; i ++ ) { mat_destroy ( bptt_updater -> out_ers + i ) ; } safe_st_free ( bptt_updater -> out_ers ) ; } safe_st_free ( bptt_updater -> wt_updaters ) ; } | <S2SV_ModStart> return ; } mat_destroy ( & bptt_updater -> cutoffs ) ; |
1,130 | CWE-000 static void rk_iommu_zap_iova ( struct rk_iommu_domain * rk_domain , dma_addr_t iova , size_t size ) { struct list_head * pos ; unsigned long flags ; spin_lock_irqsave ( & rk_domain -> iommus_lock , flags ) ; list_for_each ( pos , & rk_domain -> iommus ) { struct rk_iommu * iommu ; <S2SV_StartBug> iommu = list_entry ( pos , struct rk_iommu , node ) ; <S2SV_EndBug> <S2SV_StartBug> if ( pm_runtime_get_if_in_use ( iommu -> dev ) ) { <S2SV_EndBug> WARN_ON ( clk_bulk_enable ( iommu -> num_clocks , iommu -> clocks ) ) ; rk_iommu_zap_lines ( iommu , iova , size ) ; clk_bulk_disable ( iommu -> num_clocks , iommu -> clocks ) ; pm_runtime_put ( iommu -> dev ) ; } } spin_unlock_irqrestore ( & rk_domain -> iommus_lock , flags ) ; } | <S2SV_ModStart> * iommu ; int ret ; <S2SV_ModStart> node ) ; ret = <S2SV_ModEnd> pm_runtime_get_if_in_use ( iommu <S2SV_ModStart> -> dev ) ; if ( WARN_ON_ONCE ( ret < 0 ) ) continue ; if ( ret |
1,131 | CWE-000 void * thread_rotation ( void * data ) { int ret ; struct rotation_thread_handle * handle = data ; struct rotation_thread thread ; DBG ( "[rotation-thread]<S2SV_blank>Started<S2SV_blank>rotation<S2SV_blank>thread" ) ; if ( ! handle ) { ERR ( "[rotation-thread]<S2SV_blank>Invalid<S2SV_blank>thread<S2SV_blank>context<S2SV_blank>provided" ) ; goto end ; } rcu_register_thread ( ) ; rcu_thread_online ( ) ; health_register ( health_sessiond , HEALTH_SESSIOND_TYPE_ROTATION ) ; health_code_update ( ) ; ret = init_thread_state ( handle , & thread ) ; if ( ret ) { <S2SV_StartBug> goto end ; <S2SV_EndBug> } sessiond_notify_ready ( ) ; while ( true ) { int fd_count , i ; health_poll_entry ( ) ; DBG ( "[rotation-thread]<S2SV_blank>Entering<S2SV_blank>poll<S2SV_blank>wait" ) ; ret = lttng_poll_wait ( & thread . events , - 1 ) ; DBG ( "[rotation-thread]<S2SV_blank>Poll<S2SV_blank>wait<S2SV_blank>returned<S2SV_blank>(%i)" , ret ) ; health_poll_exit ( ) ; if ( ret < 0 ) { if ( errno == EINTR ) { continue ; } ERR ( "[rotation-thread]<S2SV_blank>Error<S2SV_blank>encountered<S2SV_blank>during<S2SV_blank>lttng_poll_wait<S2SV_blank>(%i)" , ret ) ; goto error ; } fd_count = ret ; for ( i = 0 ; i < fd_count ; i ++ ) { int fd = LTTNG_POLL_GETFD ( & thread . events , i ) ; uint32_t revents = LTTNG_POLL_GETEV ( & thread . events , i ) ; DBG ( "[rotation-thread]<S2SV_blank>Handling<S2SV_blank>fd<S2SV_blank>(%i)<S2SV_blank>activity<S2SV_blank>(%u)" , fd , revents ) ; if ( revents & LPOLLERR ) { ERR ( "[rotation-thread]<S2SV_blank>Polling<S2SV_blank>returned<S2SV_blank>an<S2SV_blank>error<S2SV_blank>on<S2SV_blank>fd<S2SV_blank>%i" , fd ) ; goto error ; } if ( fd == handle -> quit_pipe ) { DBG ( "[rotation-thread]<S2SV_blank>Quit<S2SV_blank>pipe<S2SV_blank>activity" ) ; goto exit ; } else if ( fd == lttng_pipe_get_readfd ( handle -> rotation_timer_queue -> event_pipe ) ) { ret = handle_job_queue ( handle , & thread , handle -> rotation_timer_queue ) ; if ( ret ) { ERR ( "[rotation-thread]<S2SV_blank>Failed<S2SV_blank>to<S2SV_blank>handle<S2SV_blank>rotation<S2SV_blank>timer<S2SV_blank>pipe<S2SV_blank>event" ) ; goto error ; } } else if ( fd == rotate_notification_channel -> socket ) { ret = handle_notification_channel ( fd , handle , & thread ) ; if ( ret ) { ERR ( "[rotation-thread]<S2SV_blank>Error<S2SV_blank>occured<S2SV_blank>while<S2SV_blank>handling<S2SV_blank>activity<S2SV_blank>on<S2SV_blank>notification<S2SV_blank>channel<S2SV_blank>socket" ) ; goto error ; } } } } exit : error : DBG ( "[rotation-thread]<S2SV_blank>Exit" ) ; fini_thread_state ( & thread ) ; health_unregister ( health_sessiond ) ; rcu_thread_offline ( ) ; rcu_unregister_thread ( ) ; end : return NULL ; } | <S2SV_ModStart> ) { goto error <S2SV_ModEnd> ; } sessiond_notify_ready |
1,132 | CWE-000 static void configure_syncword ( syncword_class_t syncword_class , const channel_id_t * channel ) { if ( channel -> channel_header . ch_class == PHY_CLASS_LORA ) { assert ( syncword_class == PHY_SYNCWORD_CLASS1 ) ; current_syncword_class = syncword_class ; return ; } <S2SV_StartBug> if ( syncword_class != current_syncword_class || ( channel -> channel_header . ch_coding != current_channel_id . channel_header . ch_coding ) ) <S2SV_EndBug> { current_syncword_class = syncword_class ; uint16_t sync_word = sync_word_value [ syncword_class ] [ channel -> channel_header . ch_coding ] ; DPRINT ( "sync_word<S2SV_blank>=<S2SV_blank>%04x" , sync_word ) ; write_reg ( REG_SYNCVALUE2 , sync_word & 0xFF ) ; write_reg ( REG_SYNCVALUE1 , sync_word >> 8 ) ; } <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> return ; } <S2SV_ModEnd> current_syncword_class = syncword_class <S2SV_ModStart> ) ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null> |
1,133 | CWE-000 private void continued ( mixed * ref ) { mixed * continued ; int type , token , sz , i ; mixed val , objs , timeout , args ; string func ; : : tls_set ( TLS_CONT , ref ) ; continued = ref [ REF_CONT ] ; ( { val , objs , timeout , func , args } ) = continued [ . . CONT_SIZE - 1 ] ; switch ( typeof ( objs ) ) { case T_INT : ref [ REF_CONT ] = continued [ CONT_SIZE . . ] ; if ( objs ) { val = call_other ( this_object ( ) , func , val , args ... ) ; } else { val = call_other ( this_object ( ) , func , args ... ) ; } break ; case T_OBJECT : val = objs -> next ( ) ; if ( val != nil ) { call_other ( this_object ( ) , func , val , args ... ) ; } break ; case T_ARRAY : sz = sizeof ( objs ) ; ref [ REF_CONT ] = continued = continued [ CONT_SIZE . . ] ; if ( ! storage ) { token = 0 ; storage = ( [ "token" : 0 , 0 : ref ] ) ; } else { for ( token = storage [ "token" ] ; storage [ ++ token ] ; ) ; storage [ "token" ] = token ; storage [ token ] = ref ; } ref [ REF_COUNT ] = sz ; ref [ REF_TIMEOUT ] = : : call_out ( "_F_timeoutContinuation" , timeout , token ) ; if ( sizeof ( continued ) != 0 && typeof ( continued [ CONT_OBJS ] ) == T_INT && continued [ CONT_OBJS ] ) { continued [ CONT_VAL ] = allocate ( sz ) ; } for ( i = 0 ; i < sz ; i ++ ) { <S2SV_StartBug> call_out_other ( objs [ i ] , "_F_continued" , ( { <S2SV_EndBug> ( { nil , 0 , 0 , func , args , nil , this_object ( ) , 0 , nil , ( { token , i } ) } ) , objs [ i ] , 0 , 0 } ) ) ; } return ; } continued = ref [ REF_CONT ] ; while ( sizeof ( continued ) != 0 ) { objs = continued [ CONT_OBJS ] ; switch ( typeof ( objs ) ) { case T_NIL : return ; case T_INT : if ( objs ) { continued [ CONT_VAL ] = val ; } break ; case T_OBJECT : if ( continued [ CONT_FUNC ] ) { if ( objs -> end ( ) ) { ref [ REF_CONT ] = continued = continued [ CONT_SIZE . . ] ; continue ; } } else { <S2SV_StartBug> call_out_other ( objs , "_F_doneContinuation" , val , <S2SV_EndBug> continued [ CONT_ARGS ] ... ) ; return ; } break ; } : : call_out ( "_F_continued" , 0 , ref ) ; break ; } } | <S2SV_ModStart> ++ ) { : : <S2SV_ModStart> } else { : : |
1,134 | CWE-000 unsigned char * aspire_mao_resize_image ( unsigned int * dest_image_size , unsigned char * src_image_data , unsigned int src_image_size , unsigned int size , int quality ) { if ( dest_image_size == NULL || src_image_data == NULL || src_image_size == 0 || size == 0 || quality <= 0 || quality > 100 ) return NULL ; int width = 0 ; int height = 0 ; int pixel_bytes = 3 ; int is_png = 0 ; int is_jpg = 0 ; unsigned char * rgb = NULL ; if ( aspire_mao_image_is_jpg ( src_image_data , src_image_size ) ) { is_jpg = 1 ; <S2SV_StartBug> rgb = aspire_mao_jpg_read ( src_image_data , src_image_size , & width , & height ) ; <S2SV_EndBug> } else if ( aspire_mao_image_is_png ( src_image_data , src_image_size ) ) { is_png = 1 ; rgb = aspire_mao_png_read ( src_image_data , src_image_size , & width , & height , & pixel_bytes , 0 ) ; } else { return NULL ; } if ( rgb == NULL || width == 0 || height == 0 ) return NULL ; float ratio_w = size / ( float ) width ; float ratio_h = size / ( float ) height ; float ratio = ratio_w < ratio_h ? ratio_w : ratio_h ; int dest_width = ratio * width ; int dest_height = ratio * height ; unsigned char * resize_rgb = aspire_mao_resize_rgb ( dest_width , dest_height , rgb , width , height , pixel_bytes ) ; free ( rgb ) ; unsigned char * output = NULL ; if ( is_jpg ) { output = aspire_mao_jpg_write ( dest_image_size , resize_rgb , dest_width , dest_height , quality ) ; } <S2SV_StartBug> else if ( is_png ) <S2SV_EndBug> { output = aspire_mao_png_write ( dest_image_size , resize_rgb , dest_width , dest_height , pixel_bytes ) ; } free ( resize_rgb ) ; return output ; } | <S2SV_ModStart> , & height <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } free ( resize_rgb ) ; return output <S2SV_ModEnd> ; } <S2SV_null> |
1,135 | CWE-000 void graphicsFallbackScroll ( JsGraphics * gfx , int xdir , int ydir ) { if ( xdir == 0 && ydir == 0 ) return ; <S2SV_StartBug> if ( ydir <= 0 ) { <S2SV_EndBug> int h = gfx -> data . height + xdir ; <S2SV_StartBug> for ( int y = 0 ; y < h ; y ++ ) <S2SV_EndBug> graphicsFallbackScrollX ( gfx , xdir , y - ydir , y ) ; } else { <S2SV_StartBug> for ( int y = gfx -> data . height - ydir - 1 ; y >= 0 ; y -- ) <S2SV_EndBug> graphicsFallbackScrollX ( gfx , xdir , y , y + ydir ) ; } gfx -> data . modMinX = 0 ; gfx -> data . modMinY = 0 ; gfx -> data . modMaxX = gfx -> data . width - 1 ; gfx -> data . modMaxY = gfx -> data . height - 1 ; } | <S2SV_ModStart> ) return ; int y ; <S2SV_ModStart> ; for ( <S2SV_ModEnd> y = 0 <S2SV_ModStart> { for ( <S2SV_ModEnd> y = gfx |
1,136 | CWE-000 HAL_StatusTypeDef max14662_set_value ( enum MAX14662_address address , uint8_t val ) { HAL_StatusTypeDef status ; <S2SV_StartBug> uint8_t i2c_address ; <S2SV_EndBug> if ( max14662_state [ address ] == val ) return HAL_OK ; i2c_address = resolve_address ( address ) ; <S2SV_StartBug> status = i2c_master_tx ( i2c_address << 1 , & val , sizeof ( val ) , I2C_TIMEOUT ) ; <S2SV_EndBug> if ( status != HAL_OK ) return status ; max14662_state [ address ] = val ; return status ; } | <S2SV_ModStart> ; uint8_t i2c_address ; const uint8_t data [ 2 ] = { MAX14662_REG_ADDR , val } <S2SV_ModStart> << 1 , data <S2SV_ModEnd> , sizeof ( <S2SV_ModStart> , sizeof ( data <S2SV_ModEnd> ) , I2C_TIMEOUT |
1,137 | CWE-000 Lisp_Object <S2SV_StartBug> get_frame_param ( register struct frame * frame , Lisp_Object prop ) <S2SV_EndBug> { <S2SV_StartBug> register Lisp_Object tem ; <S2SV_EndBug> <S2SV_StartBug> tem = Fassq ( prop , frame -> param_alist ) ; <S2SV_EndBug> if ( EQ ( tem , Qnil ) ) return tem ; return Fcdr ( tem ) ; } | <S2SV_ModStart> Lisp_Object get_frame_param ( <S2SV_ModEnd> struct frame * <S2SV_ModStart> prop ) { return Fcdr ( <S2SV_ModEnd> Fassq ( prop <S2SV_ModStart> -> param_alist ) <S2SV_ModEnd> ) ; } |
1,138 | CWE-000 void * PoolBroadcastThreadProc ( void * Info ) { uint64_t id = 10 ; PoolInfo * pbinfo = ( PoolInfo * ) Info ; pthread_mutex_lock ( & QueueMutex ) ; CurrentQueue . first = CurrentQueue . last = NULL ; pthread_mutex_unlock ( & QueueMutex ) ; for ( ; ; ) { <S2SV_StartBug> while ( pthread_mutex_trylock ( & QueueMutex ) ) sleep ( 1 ) ; <S2SV_EndBug> for ( Share * CurShare = RemoveShare ( & CurrentQueue ) ; CurShare ; CurShare = RemoveShare ( & CurrentQueue ) ) { uint32_t ShareNonce , ShareTime , ShareExtranonce2 ; char ASCIINonce [ 9 ] , ASCIIResult [ 65 ] , * temp , * rawsubmitrequest ; json_t * msg , * params ; uint8_t HashInput [ 76 ] , HashResult [ 32 ] ; int bytes , ret ; ShareNonce = CurShare -> Nonce ; BinaryToASCIIHex ( ASCIINonce , & ShareNonce , 4U ) ; msg = json_object ( ) ; params = json_object ( ) ; pthread_mutex_lock ( & JobMutex ) ; json_object_set_new ( params , "id" , json_string ( pbinfo -> XMRAuthID ) ) ; json_object_set_new ( params , "job_id" , json_string ( CurrentJob . ID ) ) ; json_object_set_new ( params , "nonce" , json_string ( ASCIINonce ) ) ; ASCIIHexToBinary ( HashInput , CurrentJob . XMRBlob , 76 * 2 ) ; pthread_mutex_unlock ( & JobMutex ) ; ( ( uint32_t * ) ( HashInput + 39 ) ) [ 0 ] = ShareNonce ; cryptonight_hash ( HashResult , HashInput , 76 ) ; BinaryToASCIIHex ( ASCIIResult , HashResult , 32 ) ; json_object_set_new ( params , "result" , json_string ( ASCIIResult ) ) ; json_object_set_new ( msg , "method" , json_string ( "submit" ) ) ; json_object_set_new ( msg , "params" , params ) ; json_object_set_new ( msg , "id" , json_integer ( 1 ) ) ; pthread_mutex_lock ( & StatusMutex ) ; GlobalStatus . SolvedWork ++ ; pthread_mutex_unlock ( & StatusMutex ) ; temp = json_dumps ( msg , JSON_PRESERVE_ORDER ) ; Log ( LOG_NETDEBUG , "Request:<S2SV_blank>%s\\n" , temp ) ; rawsubmitrequest = malloc ( strlen ( temp ) + 16 ) ; strcpy ( rawsubmitrequest , temp ) ; json_decref ( msg ) ; strcat ( rawsubmitrequest , "\\n" ) ; bytes = 0 ; do { ret = send ( pbinfo -> sockfd , rawsubmitrequest + bytes , strlen ( rawsubmitrequest ) - bytes , 0 ) ; if ( ret == - 1 ) return ( NULL ) ; bytes += ret ; } while ( bytes < strlen ( rawsubmitrequest ) ) ; free ( rawsubmitrequest ) ; FreeShare ( CurShare ) ; } pthread_mutex_unlock ( & QueueMutex ) ; } return ( NULL ) ; } | <S2SV_ModStart> QueueMutex ) ) Sleep <S2SV_ModEnd> ( 1 ) |
1,139 | CWE-000 void PlatformDeinit ( void ) { nrf5TempDeinit ( ) ; <S2SV_StartBug> nrf5RadioDeinit ( ) ; <S2SV_EndBug> nrf5CryptoDeinit ( ) ; nrf5MiscDeinit ( ) ; # ifndef SPIS_TRANSPORT_DISABLE nrf5SpiSlaveDeinit ( ) ; # endif <S2SV_StartBug> nrf5UartDeinit ( ) ; <S2SV_EndBug> nrf5RandomDeinit ( ) ; nrf5AlarmDeinit ( ) ; # if ( OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED ) || ( OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL ) nrf5LogDeinit ( ) ; # endif } | <S2SV_ModStart> ) ; nrf5RadioDeinit <S2SV_ModEnd> ( ) ; <S2SV_ModStart> ; # endif if ( ! gPlatformPseudoResetWasRequested ) { nrf5CryptoDeinit ( ) ; <S2SV_ModStart> ( ) ; } |
1,140 | CWE-000 void undo ( int print_moves ) { int first ; first = 1 ; if ( ( * game_moves ) . prev == NULL ) { printf ( "Error:<S2SV_blank>no<S2SV_blank>moves<S2SV_blank>to<S2SV_blank>undo\\n" ) ; return ; } while ( ( * game_moves ) . generate_autofill_command == 1 || first ) { first = 0 ; if ( ( * game_moves ) . generate_autofill_command == 3 ) { game_moves = ( * game_moves ) . prev ; continue ; } game_board [ ( * game_moves ) . x_value ] [ ( * game_moves ) . y_value ] = ( * game_moves ) . old_z_value ; erroneous_board [ ( * game_moves ) . x_value ] [ ( * game_moves ) . y_value ] = ( * game_moves ) . old_value_erroneous ; game_moves = ( * game_moves ) . prev ; <S2SV_StartBug> if ( ( * ( * game_moves ) . next ) . generate_autofill_command == 0 ) { <S2SV_EndBug> print_board ( ) ; } if ( ( * ( * game_moves ) . next ) . old_z_value == 0 ) { if ( ( * ( * game_moves ) . next ) . generate_autofill_command == 0 && print_moves ) { printf ( "Undo<S2SV_blank>%d,%d:<S2SV_blank>from<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>_\\n" , ( * ( * game_moves ) . next ) . y_value + 1 , ( * ( * game_moves ) . next ) . x_value + 1 , ( * ( * game_moves ) . next ) . new_z_value ) ; } EMPTY_CELLS_NUM ++ ; } else if ( ( * ( * game_moves ) . next ) . new_z_value == 0 ) { if ( ( * ( * game_moves ) . next ) . generate_autofill_command == 0 && print_moves ) { printf ( "Undo<S2SV_blank>%d,%d:<S2SV_blank>from<S2SV_blank>_<S2SV_blank>to<S2SV_blank>%d\\n" , ( * ( * game_moves ) . next ) . y_value + 1 , ( * ( * game_moves ) . next ) . x_value + 1 , ( * ( * game_moves ) . next ) . old_z_value ) ; } EMPTY_CELLS_NUM -- ; } else { if ( ( * ( * game_moves ) . next ) . generate_autofill_command == 0 && print_moves ) { printf ( "Undo<S2SV_blank>%d,%d:<S2SV_blank>from<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>%d\\n" , ( * ( * game_moves ) . next ) . y_value + 1 , ( * ( * game_moves ) . next ) . x_value + 1 , ( * ( * game_moves ) . next ) . new_z_value , ( * ( * game_moves ) . next ) . old_z_value ) ; } } <S2SV_StartBug> if ( ( * game_moves ) . generate_autofill_command == 2 ) { <S2SV_EndBug> print_board ( ) ; printf ( "All<S2SV_blank>recent<S2SV_blank>changes<S2SV_blank>were<S2SV_blank>undone\\n" ) ; break ; } } } | <S2SV_ModStart> ( ( * game_moves ) . generate_autofill_command == 2 ) { game_moves = ( * game_moves ) . prev ; print_board ( ) ; printf ( "All<S2SV_blank>recent<S2SV_blank>changes<S2SV_blank>were<S2SV_blank>undone\\n" ) ; break ; } if ( ( * <S2SV_ModStart> ; } } <S2SV_ModEnd> } } <S2SV_null> |
1,141 | CWE-000 Image read_image_file ( int pool_index , char * file_name ) { FILE * file = fopen ( file_name , "r" ) ; <S2SV_StartBug> if ( ! file_name ) return ( Image ) { } ; <S2SV_EndBug> int width = 0 , height = 0 ; fscanf ( file , "P7\\nWIDTH<S2SV_blank>%d\\nHEIGHT<S2SV_blank>%d\\nDEPTH<S2SV_blank>4\\nMAXVAL<S2SV_blank>255\\nTUPLTYPE<S2SV_blank>RGB_ALPHA\\nENDHDR\\n" , & width , & height ) ; if ( width && height ) { int pixel_count = width * height ; u32 * pixels = pool_alloc ( pool_index , width * height * sizeof ( u32 ) ) ; int pixels_read = fread ( pixels , sizeof ( u32 ) , pixel_count , file ) ; fclose ( file ) ; if ( pixels_read == pixel_count ) { abgr_to_rgba ( pixels , pixel_count ) ; return ( Image ) { . pixels = pixels , . width = width , . height = height } ; } } return ( Image ) { } ; } | <S2SV_ModStart> if ( ! file <S2SV_ModEnd> ) return ( |
1,142 | CWE-000 API int lyd_schema_sort ( struct lyd_node * sibling , int recursive ) { uint32_t len , i ; struct lyd_node * node ; struct lys_node * first_ssibling = NULL ; struct lyd_node_pos * array ; if ( ! sibling ) { LOGARG ; return - 1 ; } if ( sibling -> prev != sibling ) { sibling = lyd_first_sibling ( sibling ) ; len = 0 ; for ( node = sibling ; node ; node = node -> next ) { ++ len ; } array = malloc ( len * sizeof * array ) ; LY_CHECK_ERR_RETURN ( ! array , LOGMEM ( sibling -> schema -> module -> ctx ) , - 1 ) ; for ( i = 0 , node = sibling ; i < len ; ++ i , node = node -> next ) { array [ i ] . pos = 0 ; if ( ! first_ssibling || ( lyd_node_module ( node ) != lys_node_module ( first_ssibling ) ) ) { first_ssibling = node -> schema ; while ( lys_parent ( first_ssibling ) && ( lys_parent ( first_ssibling ) -> nodetype & ( LYS_CHOICE | LYS_CASE | LYS_USES ) ) ) { first_ssibling = lys_parent ( first_ssibling ) ; } if ( lys_parent ( first_ssibling ) ) { first_ssibling = lys_parent ( first_ssibling ) -> child ; } else { while ( first_ssibling -> prev -> next ) { first_ssibling = first_ssibling -> prev ; } } } if ( lys_module_node_pos_r ( first_ssibling , node -> schema , & array [ i ] . pos ) ) { free ( array ) ; return - 1 ; } array [ i ] . node = node ; } qsort ( array , len , sizeof * array , lyd_node_pos_cmp ) ; for ( i = 0 ; i < len ; ++ i ) { if ( i == 0 ) { sibling = array [ i ] . node ; if ( array [ i ] . node -> parent ) { array [ i ] . node -> parent -> child = array [ i ] . node ; } } if ( i > 0 ) { array [ i ] . node -> prev = array [ i - 1 ] . node ; } else { array [ i ] . node -> prev = array [ len - 1 ] . node ; } if ( i < len - 1 ) { array [ i ] . node -> next = array [ i + 1 ] . node ; } else { array [ i ] . node -> next = NULL ; } } free ( array ) ; } if ( recursive ) { LY_TREE_FOR ( sibling , node ) { if ( ( node -> schema -> nodetype & ( LYS_CONTAINER | LYS_LIST | LYS_RPC | LYS_ACTION | LYS_NOTIF ) ) <S2SV_StartBug> && lyd_schema_sort ( node -> child , recursive ) ) { <S2SV_EndBug> return - 1 ; } } } return EXIT_SUCCESS ; } | <S2SV_ModStart> ) ) && node -> child && |
1,143 | CWE-000 void serial_write ( uint8_t data ) { uint8_t next_head = serial_tx_buffer_head + 1 ; if ( next_head == TX_BUFFER_SIZE ) { next_head = 0 ; } while ( next_head == serial_tx_buffer_tail ) { <S2SV_StartBug> if ( sys . rt_exec_state & EXEC_RESET ) { return ; } <S2SV_EndBug> } serial_tx_buffer [ serial_tx_buffer_head ] = data ; serial_tx_buffer_head = next_head ; UCSR0B |= ( 1 << UDRIE0 ) ; } | <S2SV_ModStart> { if ( sys_rt_exec_state <S2SV_ModEnd> & EXEC_RESET ) |
1,144 | CWE-000 static int send_packets ( struct netmap_ring * ring , struct pkt * pkt , void * frame , int size , struct glob_arg * g , u_int count , int options , u_int nfrags ) { <S2SV_StartBug> u_int n , sent , cur = ring -> cur ; <S2SV_EndBug> u_int fcnt ; n = nm_ring_space ( ring ) ; if ( n < count ) count = n ; if ( count < nfrags ) { D ( "truncating<S2SV_blank>packet,<S2SV_blank>no<S2SV_blank>room<S2SV_blank>for<S2SV_blank>frags<S2SV_blank>%d<S2SV_blank>%d" , count , nfrags ) ; } # if 0 if ( options & ( OPT_COPY | OPT_PREFETCH ) ) { for ( sent = 0 ; sent < count ; sent ++ ) { struct netmap_slot * slot = & ring -> slot [ cur ] ; char * p = NETMAP_BUF ( ring , slot -> buf_idx ) ; __builtin_prefetch ( p ) ; cur = nm_ring_next ( ring , cur ) ; } cur = ring -> cur ; } # endif for ( fcnt = nfrags , sent = 0 ; sent < count ; sent ++ ) { struct netmap_slot * slot = & ring -> slot [ cur ] ; char * p = NETMAP_BUF ( ring , slot -> buf_idx ) ; <S2SV_StartBug> int buf_changed = slot -> flags & NS_BUF_CHANGED ; <S2SV_EndBug> slot -> flags = 0 ; if ( options & OPT_RUBBISH ) { } else if ( options & OPT_INDIRECT ) { slot -> flags |= NS_INDIRECT ; slot -> ptr = ( uint64_t ) ( ( uintptr_t ) frame ) ; <S2SV_StartBug> } else if ( ( options & OPT_COPY ) || buf_changed ) { <S2SV_EndBug> nm_pkt_copy ( frame , p , size ) ; if ( fcnt == nfrags ) update_addresses ( pkt , g ) ; } else if ( options & OPT_MEMCPY ) { memcpy ( p , frame , size ) ; if ( fcnt == nfrags ) update_addresses ( pkt , g ) ; } else if ( options & OPT_PREFETCH ) { __builtin_prefetch ( p ) ; } if ( options & OPT_DUMP ) dump_payload ( p , size , ring , cur ) ; slot -> len = size ; if ( -- fcnt > 0 ) slot -> flags |= NS_MOREFRAG ; else fcnt = nfrags ; if ( sent == count - 1 ) { slot -> flags &= ~ NS_MOREFRAG ; slot -> flags |= NS_REPORT ; } cur = nm_ring_next ( ring , cur ) ; } ring -> head = ring -> cur = cur ; return ( sent ) ; } | <S2SV_ModStart> n , sent , vh = g -> virt_header <S2SV_ModStart> buf_idx ) ; struct pkt * old = ( struct pkt * ) ( p - sizeof ( old -> vh ) + vh ) ; int copy = options & OPT_COPY || <S2SV_ModEnd> slot -> flags <S2SV_ModStart> flags & NS_BUF_CHANGED ; copy || = ( old -> eh -> ether_type == htons ( ETHERTYPE_ARP ) ) <S2SV_ModStart> else if ( copy <S2SV_ModEnd> ) { nm_pkt_copy |
1,145 | CWE-000 static apr_status_t agg_put_qexec ( agg_t * agg , const qexec_packet_t * qexec_packet , apr_int64_t generation ) { qdnode_t * dp ; gpmon_qlogkey_t key ; mmon_qexec_t * mmon_qexec_existing = 0 ; key . tmid = qexec_packet -> data . key . tmid ; key . ssid = qexec_packet -> data . key . ssid ; key . ccnt = qexec_packet -> data . key . ccnt ; dp = apr_hash_get ( agg -> qtab , & key , sizeof ( key ) ) ; if ( ! dp ) { return 0 ; } mmon_qexec_existing = apr_hash_get ( dp -> qexec_hash , & qexec_packet -> data . key . hash_key , sizeof ( qexec_packet -> data . key . hash_key ) ) ; if ( mmon_qexec_existing ) { mmon_qexec_existing -> key . ccnt = qexec_packet -> data . key . ccnt ; mmon_qexec_existing -> key . ssid = qexec_packet -> data . key . ssid ; mmon_qexec_existing -> key . tmid = qexec_packet -> data . key . tmid ; mmon_qexec_existing -> _cpu_elapsed = qexec_packet -> data . _cpu_elapsed ; mmon_qexec_existing -> measures_rows_in = qexec_packet -> data . measures_rows_in ; mmon_qexec_existing -> rowsout = qexec_packet -> data . rowsout ; } else { <S2SV_StartBug> memcpy ( & mmon_qexec_existing -> key , & qexec_packet -> data . key , sizeof ( gpmon_qexeckey_t ) ) ; <S2SV_EndBug> mmon_qexec_existing -> _cpu_elapsed = qexec_packet -> data . _cpu_elapsed ; mmon_qexec_existing -> measures_rows_in = qexec_packet -> data . measures_rows_in ; mmon_qexec_existing -> rowsout = qexec_packet -> data . rowsout ; apr_hash_set ( dp -> qexec_hash , & mmon_qexec_existing -> key . hash_key , sizeof ( mmon_qexec_existing -> key . hash_key ) , mmon_qexec_existing ) ; } dp -> last_updated_generation = generation ; return 0 ; } | <S2SV_ModStart> } else { if ( ! ( mmon_qexec_existing = apr_palloc ( agg -> pool , sizeof ( mmon_qexec_t ) ) ) ) return APR_ENOMEM ; |
1,146 | CWE-000 int File_Read ( int fd , void * buffer , int size ) { printf ( "FS_Read\\n" ) ; if ( isFileOpen ( buffer ) == - 1 ) { osErrno = E_BAD_FD ; printf ( "File<S2SV_blank>is<S2SV_blank>not<S2SV_blank>open\\n" ) ; return - 1 ; } <S2SV_StartBug> int sizeRead = FileRead ( int fd , char * buffer , int size ) <S2SV_EndBug> if ( sizeRead == - 1 ) { printf ( "Error<S2SV_blank>happen<S2SV_blank>in<S2SV_blank>Reading\\n" ) ; return - 1 ; } return sizeRead ; } | <S2SV_ModStart> = FileRead ( fd , buffer , size ) ; <S2SV_ModEnd> if ( sizeRead |
1,147 | CWE-000 int tls13_derive_key ( SSL * s , const EVP_MD * md , const unsigned char * secret , unsigned char * key , size_t keylen ) { static const unsigned char keylabel [ ] = "key" ; return tls13_hkdf_expand ( s , md , secret , keylabel , sizeof ( keylabel ) - 1 , <S2SV_StartBug> NULL , 0 , key , keylen ) ; <S2SV_EndBug> } | <S2SV_ModStart> key , keylen , 1 |
1,148 | CWE-000 <S2SV_StartBug> void IN_Button4Down ( void ) { KeyDown ( & in_button4 ) ; } <S2SV_EndBug> | <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static <S2SV_ModStart> ( & in_button4 , NULL |
1,149 | CWE-000 char snck_line_get ( struct snck_ctxt const * const p_ctxt , FILE * const p_file , struct snck_string * const p_string ) { char b_result ; if ( stdin == p_file ) { struct snck_string o_prompt ; snck_string_init ( p_ctxt , & ( o_prompt ) ) ; if ( snck_prompt_get ( p_ctxt , & ( o_prompt ) ) ) { # if defined ( SNCK_FEATURE_LINENOISE ) { char * p_temp ; linenoiseSetCompletionCallback ( snck_completion ) ; g_ctxt = p_ctxt ; errno = 0 ; p_temp = linenoise ( o_prompt . p_buf ) ; g_ctxt = NULL ; if ( p_temp ) { if ( ( '<S2SV_blank>' != p_temp [ 0u ] ) && ( '\\000' != p_temp [ 0u ] ) ) { snck_history_load ( p_ctxt ) ; snck_history_add ( p_ctxt , p_temp ) ; snck_history_save ( p_ctxt ) ; snck_history_unload ( p_ctxt ) ; } b_result = snck_string_copy ( p_ctxt , p_string , p_temp ) ; free ( p_temp ) ; } else { if ( errno == EAGAIN ) { static char const a_newline [ ] = { '\\n' } ; b_result = snck_string_copy_buffer ( p_ctxt , p_string , a_newline , sizeof ( a_newline ) ) ; } else { b_result = 0 ; } } } # else { if ( snck_string_resize ( p_ctxt , p_string , 65536u ) ) { fprintf ( stdout , "%s" , o_prompt . p_buf ) ; fflush ( stdout ) ; if ( NULL != fgets ( p_string -> p_buf , p_string -> i_alloc_len , stdin ) ) { p_string -> i_buf_len = strlen ( p_string -> p_buf ) ; b_result = 1 ; } else { snck_string_resize ( p_ctxt , p_string , 0u ) ; b_result = 0 ; } } else { b_result = 0 ; } } # endif } else { b_result = 0 ; } snck_string_cleanup ( p_ctxt , & ( o_prompt ) ) ; } else { if ( snck_string_resize ( p_ctxt , p_string , 65536u ) ) { <S2SV_StartBug> if ( NULL != fgets ( p_string -> p_buf , p_string -> i_alloc_len , stdin ) ) <S2SV_EndBug> { p_string -> i_buf_len = strlen ( p_string -> p_buf ) ; b_result = 1 ; } else { snck_string_resize ( p_ctxt , p_string , 0u ) ; b_result = 0 ; } } else { b_result = 0 ; } } # if 0 if ( ! b_result ) { fprintf ( stderr , "...<S2SV_blank>bye!\\n" ) ; } # endif return b_result ; } | <S2SV_ModStart> -> i_alloc_len , p_file <S2SV_ModEnd> ) ) { |
1,150 | CWE-000 void * incrWorkerThread ( void * args ) { struct WorkerArgs * wArgs = ( struct WorkerArgs * ) args ; char * coordinatorLocator = wArgs -> coordinatorLocator ; uint64_t requests = wArgs -> requests ; uint64_t valueSize = wArgs -> valueSize ; uint64_t keySpaceLength = wArgs -> keySpaceLength ; Context * context = ramdis_connect ( coordinatorLocator ) ; struct WorkerStats * wStats = ( struct WorkerStats * ) malloc ( sizeof ( struct WorkerStats ) ) ; uint64_t * latencies = ( uint64_t * ) malloc ( requests * sizeof ( uint64_t ) ) ; int i ; Object key ; char keyBuf [ 16 ] ; key . len = sizeof ( keyBuf ) ; <S2SV_StartBug> uint64_t testStart = ustime ( ) ; <S2SV_EndBug> for ( i = 0 ; i < requests ; i ++ ) { snprintf ( keyBuf , 16 , "%015d" , rand ( ) % keySpaceLength ) ; key . data = keyBuf ; uint64_t reqStart = ustime ( ) ; incr ( context , & key ) ; latencies [ i ] = ustime ( ) - reqStart ; <S2SV_StartBug> if ( i % ( requests / 100 ) == 0 ) { <S2SV_EndBug> printf ( "Progress:<S2SV_blank>%3d%%\\r" , i * 100 / requests ) ; fflush ( stdout ) ; } } uint64_t testEnd = ustime ( ) ; wStats -> latencies = latencies ; ramdis_disconnect ( context ) ; return wStats ; } | <S2SV_ModStart> ) ; uint64_t progressUnit = ( requests / 100 ) > 0 ? ( requests / 100 ) : 1 ; uint64_t <S2SV_ModStart> ( i % progressUnit <S2SV_ModEnd> == 0 ) |
1,151 | CWE-000 <S2SV_StartBug> static void buffer_draw_button ( uint8_t * Text , uint8_t X , uint8_t Y , uint8_t Inverted ) <S2SV_EndBug> { buffer_write_text ( Text , ++ X , Y ) ; <S2SV_StartBug> buffer_draw_rectangle ( X - 1 , ( Y * 4 ) , strlen ( Text ) * 8 + 1 , 12 , COLOR_BLACK ) ; <S2SV_EndBug> if ( Inverted ) { buffer_invert ( X , ( Y * 4 ) + 1 , strlen ( Text ) * 8 , 11 ) ; } } | <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> <S2SV_ModEnd> void buffer_draw_button ( <S2SV_ModStart> * 4 ) - 1 , ( <S2SV_ModEnd> strlen ( Text <S2SV_ModStart> ( Text ) - 1 ) * 8 , 10 <S2SV_ModEnd> , COLOR_BLACK ) |
1,152 | CWE-000 char * dump_server_config ( struct server_config * sc , char * buf , size_t size ) { <S2SV_StartBug> snprintf ( buf , size , "%s\\n<S2SV_blank>%s\\n<S2SV_blank>%d\\n<S2SV_blank>%d\\n" , <S2SV_EndBug> sc -> hostname , sc -> service , sc -> port , sc -> backlog ) ; return buf ; } | <S2SV_ModStart> , size , "%s\\n%s\\n%d\\n%d\\n" <S2SV_ModEnd> , sc -> |
1,153 | CWE-000 static int gred_change ( struct Qdisc * sch , struct nlattr * opt , struct netlink_ext_ack * extack ) { struct gred_sched * table = qdisc_priv ( sch ) ; struct tc_gred_qopt * ctl ; struct nlattr * tb [ TCA_GRED_MAX + 1 ] ; int err , prio = GRED_DEF_PRIO ; u8 * stab ; u32 max_P ; struct gred_sched_data * prealloc ; if ( opt == NULL ) return - EINVAL ; err = nla_parse_nested ( tb , TCA_GRED_MAX , opt , gred_policy , NULL ) ; if ( err < 0 ) return err ; if ( tb [ TCA_GRED_PARMS ] == NULL && tb [ TCA_GRED_STAB ] == NULL ) { if ( tb [ TCA_GRED_LIMIT ] != NULL ) sch -> limit = nla_get_u32 ( tb [ TCA_GRED_LIMIT ] ) ; <S2SV_StartBug> return gred_change_table_def ( sch , opt ) ; <S2SV_EndBug> } if ( tb [ TCA_GRED_PARMS ] == NULL || tb [ TCA_GRED_STAB ] == NULL || tb [ TCA_GRED_LIMIT ] != NULL ) return - EINVAL ; max_P = tb [ TCA_GRED_MAX_P ] ? nla_get_u32 ( tb [ TCA_GRED_MAX_P ] ) : 0 ; err = - EINVAL ; ctl = nla_data ( tb [ TCA_GRED_PARMS ] ) ; stab = nla_data ( tb [ TCA_GRED_STAB ] ) ; if ( ctl -> DP >= table -> DPs ) goto errout ; if ( gred_rio_mode ( table ) ) { if ( ctl -> prio == 0 ) { int def_prio = GRED_DEF_PRIO ; if ( table -> tab [ table -> def ] ) def_prio = table -> tab [ table -> def ] -> prio ; printk ( KERN_DEBUG "GRED:<S2SV_blank>DP<S2SV_blank>%u<S2SV_blank>does<S2SV_blank>not<S2SV_blank>have<S2SV_blank>a<S2SV_blank>prio<S2SV_blank>" "setting<S2SV_blank>default<S2SV_blank>to<S2SV_blank>%d\\n" , ctl -> DP , def_prio ) ; prio = def_prio ; } else prio = ctl -> prio ; } prealloc = kzalloc ( sizeof ( * prealloc ) , GFP_KERNEL ) ; sch_tree_lock ( sch ) ; err = gred_change_vq ( sch , ctl -> DP , ctl , prio , stab , max_P , & prealloc ) ; if ( err < 0 ) goto errout_locked ; if ( gred_rio_mode ( table ) ) { gred_disable_wred_mode ( table ) ; if ( gred_wred_mode_check ( sch ) ) gred_enable_wred_mode ( table ) ; } err = 0 ; errout_locked : sch_tree_unlock ( sch ) ; kfree ( prealloc ) ; errout : return err ; } | <S2SV_ModStart> ( sch , tb [ TCA_GRED_DPS ] <S2SV_ModEnd> ) ; } |
1,154 | CWE-000 void ol_tx_completion_handler ( ol_txrx_pdev_handle pdev , int num_msdus , enum htt_tx_status status , void * tx_desc_id_iterator ) { int i ; u_int16_t * desc_ids = ( u_int16_t * ) tx_desc_id_iterator ; u_int16_t tx_desc_id ; struct ol_tx_desc_t * tx_desc ; char * trace_str ; uint32_t byte_cnt = 0 ; adf_nbuf_t netbuf ; union ol_tx_desc_list_elem_t * lcl_freelist = NULL ; union ol_tx_desc_list_elem_t * tx_desc_last = NULL ; <S2SV_StartBug> ol_tx_desc_list tx_descs ; <S2SV_EndBug> TAILQ_INIT ( & tx_descs ) ; OL_TX_DELAY_COMPUTE ( pdev , status , desc_ids , num_msdus ) ; trace_str = ( status ) ? "OT:C:F:" : "OT:C:S:" ; for ( i = 0 ; i < num_msdus ; i ++ ) { tx_desc_id = desc_ids [ i ] ; tx_desc = ol_tx_desc_find ( pdev , tx_desc_id ) ; tx_desc -> status = status ; netbuf = tx_desc -> netbuf ; NBUF_UPDATE_TX_PKT_COUNT ( netbuf , NBUF_TX_PKT_FREE ) ; DPTRACE ( adf_dp_trace_ptr ( netbuf , ADF_DP_TRACE_FREE_PACKET_PTR_RECORD , adf_nbuf_data_addr ( netbuf ) , sizeof ( adf_nbuf_data ( netbuf ) ) , tx_desc -> id , status ) ) ; if ( pdev -> cfg . is_high_latency ) { OL_TX_DESC_UPDATE_GROUP_CREDIT ( pdev , tx_desc_id , 1 , 0 , status ) ; } if ( pdev -> ol_tx_packetdump_cb ) <S2SV_StartBug> pdev -> ol_tx_packetdump_cb ( netbuf , status , tx_desc -> vdev -> vdev_id , <S2SV_EndBug> TX_DATA_PKT ) ; htc_pm_runtime_put ( pdev -> htt_pdev -> htc_pdev ) ; adf_nbuf_trace_update ( netbuf , trace_str ) ; byte_cnt += adf_nbuf_len ( netbuf ) ; if ( OL_TX_DESC_NO_REFS ( tx_desc ) ) { ol_tx_statistics ( pdev -> ctrl_pdev , HTT_TX_DESC_VDEV_ID_GET ( * ( ( u_int32_t * ) ( tx_desc -> htt_tx_desc ) ) ) , status != htt_tx_status_ok ) ; ol_tx_msdu_complete ( pdev , tx_desc , tx_descs , netbuf , <S2SV_StartBug> lcl_freelist , tx_desc_last , status ) ; <S2SV_EndBug> } # ifdef QCA_SUPPORT_TXDESC_SANITY_CHECKS <S2SV_StartBug> tx_desc -> pkt_type = ol_tx_frm_freed ; <S2SV_EndBug> # ifdef QCA_COMPUTE_TX_DELAY tx_desc -> entry_timestamp_ticks = 0xffffffff ; # endif <S2SV_StartBug> # endif <S2SV_EndBug> } if ( lcl_freelist ) { adf_os_spin_lock ( & pdev -> tx_mutex ) ; tx_desc_last -> next = pdev -> tx_desc . freelist ; pdev -> tx_desc . freelist = lcl_freelist ; pdev -> tx_desc . num_free += ( u_int16_t ) num_msdus ; adf_os_spin_unlock ( & pdev -> tx_mutex ) ; } else { ol_tx_desc_frame_list_free ( pdev , & tx_descs , status != htt_tx_status_ok ) ; } if ( pdev -> cfg . is_high_latency ) { adf_os_atomic_add ( num_msdus , & pdev -> tx_queue . rsrc_cnt ) ; ol_tx_sched ( pdev ) ; } else { OL_TX_TARGET_CREDIT_ADJUST ( num_msdus , pdev , NULL ) ; } OL_TX_FLOW_CT_UNPAUSE_OS_Q ( pdev ) ; TXRX_STATS_UPDATE_TX_STATS ( pdev , status , num_msdus , byte_cnt ) ; } | <S2SV_ModStart> ; ol_tx_desc_list tx_descs ; uint32_t is_tx_desc_freed = 0 <S2SV_ModStart> , tx_desc -> <S2SV_ModEnd> vdev_id , TX_DATA_PKT <S2SV_ModStart> tx_desc_last , status , is_tx_desc_freed ) ; <S2SV_ModEnd> # ifdef QCA_SUPPORT_TXDESC_SANITY_CHECKS <S2SV_ModStart> # ifdef QCA_SUPPORT_TXDESC_SANITY_CHECKS if ( ! is_tx_desc_freed ) { <S2SV_ModStart> ; # endif } # endif } <S2SV_ModEnd> } if ( |
1,155 | CWE-000 static void mlxsw_sp_router_neigh_ent_ipv4_process ( struct mlxsw_sp * mlxsw_sp , char * rauhtd_pl , int ent_index ) { struct net_device * dev ; struct neighbour * n ; __be32 dipn ; u32 dip ; u16 rif ; mlxsw_reg_rauhtd_ent_ipv4_unpack ( rauhtd_pl , ent_index , & rif , & dip ) ; if ( ! mlxsw_sp -> router -> rifs [ rif ] ) { dev_err_ratelimited ( mlxsw_sp -> bus_info -> dev , "Incorrect<S2SV_blank>RIF<S2SV_blank>in<S2SV_blank>neighbour<S2SV_blank>entry\\n" ) ; return ; } dipn = htonl ( dip ) ; dev = mlxsw_sp -> router -> rifs [ rif ] -> dev ; n = neigh_lookup ( & arp_tbl , & dipn , dev ) ; <S2SV_StartBug> if ( ! n ) { <S2SV_EndBug> netdev_err ( dev , "Failed<S2SV_blank>to<S2SV_blank>find<S2SV_blank>matching<S2SV_blank>neighbour<S2SV_blank>for<S2SV_blank>IP=%pI4h\\n" , & dip ) ; return ; } netdev_dbg ( dev , "Updating<S2SV_blank>neighbour<S2SV_blank>with<S2SV_blank>IP=%pI4h\\n" , & dip ) ; neigh_event_send ( n , NULL ) ; neigh_release ( n ) ; } | <S2SV_ModStart> ! n ) return ; <S2SV_ModEnd> netdev_dbg ( dev |
1,156 | CWE-000 cpl_size cr2res_get_nb_traces ( const cpl_table * trace_wave , int order ) { cpl_size nrows , i , count ; if ( trace_wave == NULL ) return - 1 ; count = 0 ; nrows = cpl_table_get_nrow ( trace_wave ) ; for ( i = 0 ; i < nrows ; i ++ ) <S2SV_StartBug> if ( cpl_table_get ( trace_wave , CR2RES_COL_ORDER , i , NULL ) == order ) <S2SV_EndBug> <S2SV_StartBug> count ++ ; <S2SV_EndBug> return count ; } | <S2SV_ModStart> == order ) { <S2SV_ModStart> count ++ ; } |
1,157 | CWE-000 static void xneur_reload ( int status ) { if ( status ) { } log_message ( LOG , _ ( "Caught<S2SV_blank>SIGHUP,<S2SV_blank>reloading<S2SV_blank>configuration<S2SV_blank>file" ) ) ; show_notify ( NOTIFY_XNEUR_RELOAD , NULL ) ; sound_uninit ( ) ; unbind_actions ( ) ; unbind_user_actions ( ) ; program -> plugin -> xneur_reload ( program -> plugin ) ; if ( xconfig != NULL ) xconfig -> uninit ( xconfig ) ; xconfig = xneur_config_init ( ) ; if ( xconfig == NULL ) { log_message ( ERROR , _ ( "Can\'t<S2SV_blank>init<S2SV_blank>libxnconfig" ) ) ; exit ( EXIT_FAILURE ) ; } xneur_load_config ( ) ; xneur_init ( ) ; sound_init ( ) ; popup_init ( ) ; for ( int i = 0 ; i < xconfig -> plugins -> data_count ; i ++ ) { program -> plugin -> add ( program -> plugin , xconfig -> plugins -> data [ i ] . string ) ; } <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> ) ; } program -> buffer -> handle = xconfig -> handle ; program -> correction_buffer -> handle = xconfig -> handle ; |
1,158 | CWE-000 static int cma_resolve_ib_dev ( struct rdma_id_private * id_priv ) { struct cma_device * cma_dev , * cur_dev ; struct sockaddr_ib * addr ; union ib_gid gid , sgid , * dgid ; u16 pkey , index ; u8 p ; int i ; cma_dev = NULL ; addr = ( struct sockaddr_ib * ) cma_dst_addr ( id_priv ) ; dgid = ( union ib_gid * ) & addr -> sib_addr ; pkey = ntohs ( addr -> sib_pkey ) ; <S2SV_StartBug> list_for_each_entry ( cur_dev , & dev_list , list ) { <S2SV_EndBug> if ( rdma_node_get_transport ( cur_dev -> device -> node_type ) != RDMA_TRANSPORT_IB ) continue ; for ( p = 1 ; p <= cur_dev -> device -> phys_port_cnt ; ++ p ) { if ( ib_find_cached_pkey ( cur_dev -> device , p , pkey , & index ) ) continue ; for ( i = 0 ; ! ib_get_cached_gid ( cur_dev -> device , p , i , & gid ) ; i ++ ) { if ( ! memcmp ( & gid , dgid , sizeof ( gid ) ) ) { cma_dev = cur_dev ; sgid = gid ; id_priv -> id . port_num = p ; goto found ; } if ( ! cma_dev && ( gid . global . subnet_prefix == dgid -> global . subnet_prefix ) ) { cma_dev = cur_dev ; sgid = gid ; id_priv -> id . port_num = p ; <S2SV_StartBug> } <S2SV_EndBug> } } } if ( ! cma_dev ) return - ENODEV ; found : cma_attach_to_dev ( id_priv , cma_dev ) ; <S2SV_StartBug> addr = ( struct sockaddr_ib * ) cma_src_addr ( id_priv ) ; <S2SV_EndBug> <S2SV_StartBug> memcpy ( & addr -> sib_addr , & sgid , sizeof sgid ) ; <S2SV_EndBug> cma_translate_ib ( addr , & id_priv -> id . route . addr . dev_addr ) ; return 0 ; } | <S2SV_ModStart> sib_pkey ) ; mutex_lock ( & lock ) ; <S2SV_ModStart> = p ; goto found ; } } } } mutex_unlock ( & lock ) ; <S2SV_ModEnd> return - ENODEV <S2SV_ModStart> cma_dev ) ; mutex_unlock ( & lock ) ; <S2SV_ModStart> sgid , sizeof ( sgid ) <S2SV_ModEnd> ) ; cma_translate_ib |
1,159 | CWE-000 void vy_lsm_force_compaction ( struct vy_lsm * lsm ) { struct vy_range * range ; struct vy_range_tree_iterator it ; vy_range_tree_ifirst ( lsm -> tree , & it ) ; <S2SV_StartBug> while ( ( range = vy_range_tree_inext ( & it ) ) != NULL ) <S2SV_EndBug> vy_range_force_compaction ( range ) ; vy_range_heap_update_all ( & lsm -> range_heap ) ; } | <S2SV_ModStart> != NULL ) { range -> needs_compaction = true ; vy_range_update_compact_priority ( range , & lsm -> opts ) ; } <S2SV_ModEnd> vy_range_heap_update_all ( & |
1,160 | CWE-000 void LinkDestroyQueue ( LinkCircleQueue * * _pQueue ) { CircleQueueImp * pQueueImp = ( CircleQueueImp * ) ( * _pQueue ) ; StopPush ( * _pQueue ) ; pthread_mutex_destroy ( & pQueueImp -> mutex_ ) ; pthread_cond_destroy ( & pQueueImp -> condition_ ) ; <S2SV_StartBug> free ( pQueueImp ) ; <S2SV_EndBug> * _pQueue = NULL ; return ; } | <S2SV_ModStart> condition_ ) ; if ( pQueueImp -> pData_ ) free ( pQueueImp -> pData_ ) ; |
1,161 | CWE-000 static enum simplepost_addrerr __get_default_address ( char * * addr , size_t * size ) { if ( addr == NULL || size == NULL ) return SP_AE_MEM_ALLOC ; enum simplepost_addrerr ret ; struct sockaddr_in def_addr ; socklen_t def_addr_len ; memset ( & def_addr , 0 , sizeof ( def_addr ) ) ; def_addr . sin_family = AF_INET ; def_addr_len = sizeof ( def_addr ) ; ret = __get_default_sockaddr ( ( struct sockaddr * ) & def_addr , & def_addr_len ) ; if ( ret < 0 ) return ret ; char * tmp_addr ; size_t tmp_addr_len ; tmp_addr = inet_ntoa ( def_addr . sin_addr ) ; if ( tmp_addr == NULL ) return SP_AE_FATAL ; tmp_addr_len = strlen ( tmp_addr ) ; if ( * addr == NULL || * size == 0 ) { * addr = ( char * ) malloc ( sizeof ( char ) * ( tmp_addr_len + 1 ) ) ; if ( * addr == NULL ) { * size = 0 ; return SP_AE_MEM_ALLOC ; } * size = tmp_addr_len + 1 ; } else if ( * size <= tmp_addr_len ) { char * realloc_addr = ( char * ) realloc ( * addr , sizeof ( char ) * ( tmp_addr_len + 1 ) ) ; if ( realloc_addr == NULL ) { return SP_AE_MEM_ALLOC ; } * addr = realloc_addr ; * size = tmp_addr_len + 1 ; } <S2SV_StartBug> strncpy ( * addr , tmp_addr , tmp_addr_len ) ; <S2SV_EndBug> ( * addr ) [ tmp_addr_len ] = '\\0' ; return ret ; } | <S2SV_ModStart> 1 ; } strcpy ( * addr , tmp_addr <S2SV_ModEnd> ) ; ( |
1,162 | CWE-000 Datum gp_read_error_log ( PG_FUNCTION_ARGS ) { FuncCallContext * funcctx ; ReadErrorLogContext * context ; HeapTuple tuple ; Datum result ; Assert ( Gp_role != GP_ROLE_DISPATCH ) ; if ( SRF_IS_FIRSTCALL ( ) ) { MemoryContext oldcontext ; text * relname ; RangeVar * relrv ; Oid relid ; AclResult aclresult ; funcctx = SRF_FIRSTCALL_INIT ( ) ; relname = PG_GETARG_TEXT_P ( 0 ) ; oldcontext = MemoryContextSwitchTo ( funcctx -> multi_call_memory_ctx ) ; context = palloc0 ( sizeof ( ReadErrorLogContext ) ) ; funcctx -> user_fctx = ( void * ) context ; funcctx -> tuple_desc = BlessTupleDesc ( GetErrorTupleDesc ( ) ) ; relrv = makeRangeVarFromNameList ( textToQualifiedNameList ( relname ) ) ; <S2SV_StartBug> relid = RangeVarGetRelid ( relrv , true ) ; <S2SV_EndBug> if ( OidIsValid ( relid ) ) { aclresult = pg_class_aclcheck ( relid , GetUserId ( ) , ACL_SELECT ) ; if ( aclresult != ACLCHECK_OK ) aclcheck_error ( aclresult , ACL_KIND_CLASS , relrv -> relname ) ; ErrorLogFileName ( context -> filename , MyDatabaseId , relid ) ; context -> fp = AllocateFile ( context -> filename , "r" ) ; } MemoryContextSwitchTo ( oldcontext ) ; } funcctx = SRF_PERCALL_SETUP ( ) ; context = ( ReadErrorLogContext * ) funcctx -> user_fctx ; if ( context -> fp ) { pg_crc32 crc , written_crc ; tuple = ErrorLogRead ( context -> fp , & written_crc ) ; if ( HeapTupleIsValid ( tuple ) ) { INIT_CRC32C ( crc ) ; COMP_CRC32C ( crc , tuple -> t_data , tuple -> t_len ) ; FIN_CRC32C ( crc ) ; if ( ! EQ_CRC32C ( crc , written_crc ) ) { elog ( LOG , "incorrect<S2SV_blank>checksum<S2SV_blank>in<S2SV_blank>error<S2SV_blank>log<S2SV_blank>%s" , context -> filename ) ; tuple = NULL ; } } if ( HeapTupleIsValid ( tuple ) ) { HeapTupleHeaderSetTypMod ( tuple -> t_data , funcctx -> tuple_desc -> tdtypmod ) ; result = HeapTupleGetDatum ( tuple ) ; SRF_RETURN_NEXT ( funcctx , result ) ; } } if ( context -> fp != NULL ) { FreeFile ( context -> fp ) ; context -> fp = NULL ; } SRF_RETURN_DONE ( funcctx ) ; } | <S2SV_ModStart> ( relrv , NoLock , |
1,163 | CWE-000 void bt_conn_set_state ( FAR struct bt_conn_s * conn , enum bt_conn_state_e state ) { enum bt_conn_state_e old_state ; winfo ( "%s<S2SV_blank>-><S2SV_blank>%s\\n" , state2str ( conn -> state ) , state2str ( state ) ) ; if ( conn -> state == state ) { wlwarn ( "no<S2SV_blank>transition\\n" ) ; return ; } old_state = conn -> state ; conn -> state = state ; if ( old_state == BT_CONN_DISCONNECTED ) { bt_conn_get ( conn ) ; } switch ( conn -> state ) { case BT_CONN_CONNECTED : nano_fifo_init ( & conn -> tx_queue ) ; fiber_start ( conn -> tx_stack , sizeof ( conn -> tx_stack ) , <S2SV_StartBug> conn_tx_fiber , ( int ) bt_conn_get ( conn ) , 0 , 7 , 0 ) ; <S2SV_EndBug> break ; case BT_CONN_DISCONNECTED : if ( old_state == BT_CONN_CONNECTED || old_state == BT_CONN_DISCONNECT ) { nano_fifo_put ( & conn -> tx_queue , bt_buf_get ( BT_DUMMY , 0 ) ) ; } bt_conn_put ( conn ) ; break ; case BT_CONN_CONNECT_SCAN : case BT_CONN_CONNECT : case BT_CONN_DISCONNECT : break ; default : wlwarn ( "no<S2SV_blank>valid<S2SV_blank>(%u)<S2SV_blank>state<S2SV_blank>was<S2SV_blank>set\\n" , state ) ; break ; } } | <S2SV_ModStart> tx_stack ) , conn_tx_thread <S2SV_ModEnd> , ( int |
1,164 | CWE-000 static int pci_bus_reset ( struct pci_bus * bus , int probe ) <S2SV_StartBug> { <S2SV_EndBug> if ( ! bus -> self || ! pci_bus_resetable ( bus ) ) return - ENOTTY ; if ( probe ) return 0 ; pci_bus_lock ( bus ) ; might_sleep ( ) ; <S2SV_StartBug> pci_reset_bridge_secondary_bus ( bus -> self ) ; <S2SV_EndBug> pci_bus_unlock ( bus ) ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> } | <S2SV_ModStart> probe ) { int ret ; <S2SV_ModStart> ( ) ; ret = <S2SV_ModStart> ) ; return ret <S2SV_ModEnd> ; } <S2SV_null> |
1,165 | CWE-000 static const char * make_tmp_symbol ( symtable_t * symtable , node_t * target , const char * str ) { char buffer [ 32 ] ; int tries = 0 ; while ( tries < 8 ) { if ( target -> type == NODE_VAR ) { sprintf ( buffer , "$%s_%s%d" , ( ( node_var_t * ) target ) -> identifier , str , tries ) ; } <S2SV_StartBug> if ( symtable_lookup ( symtable , buffer , NULL ) ) tries ++ ; <S2SV_EndBug> else break ; } if ( tries >= 8 ) { report_error ( "Could<S2SV_blank>not<S2SV_blank>make<S2SV_blank>unique<S2SV_blank>identifier\\n" ) ; return NULL ; } return _strdup ( buffer ) ; } | <S2SV_ModStart> ) ; } else if ( target -> type == NODE_RANGE ) { sprintf ( buffer , "$range_%s%d" , str , tries ) ; } |
1,166 | CWE-000 void mods_wake_n_set ( PinState pstate ) { <S2SV_StartBug> HAL_GPIO_WritePin ( GPIO_PORT_WAKE_N , GPIO_PIN_0 , pstate ) ; <S2SV_EndBug> } | <S2SV_ModStart> ( GPIO_PORT_WAKE_N , GPIO_PIN_WAKE_N <S2SV_ModEnd> , pstate ) |
1,167 | CWE-000 static void e_cal_meta_backend_constructed ( GObject * object ) { ECalMetaBackend * meta_backend = E_CAL_META_BACKEND ( object ) ; G_OBJECT_CLASS ( e_cal_meta_backend_parent_class ) -> constructed ( object ) ; meta_backend -> priv -> current_online_state = e_backend_get_online ( E_BACKEND ( meta_backend ) ) ; meta_backend -> priv -> notify_online_id = g_signal_connect ( meta_backend , "notify::online" , G_CALLBACK ( ecmb_notify_online_cb ) , meta_backend ) ; if ( ! meta_backend -> priv -> cache ) { ECalCache * cache ; gchar * filename ; filename = g_build_filename ( e_cal_backend_get_cache_dir ( E_CAL_BACKEND ( meta_backend ) ) , "cache.db" , NULL ) ; cache = e_cal_cache_new ( filename , NULL , & meta_backend -> priv -> create_cache_error ) ; <S2SV_StartBug> g_prefix_error ( & meta_backend -> priv -> create_cache_error , _ ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>cache<S2SV_blank>”%s”:" ) , filename ) ; <S2SV_EndBug> g_free ( filename ) ; if ( cache ) { e_cal_meta_backend_set_cache ( meta_backend , cache ) ; g_clear_object ( & cache ) ; } } } | <S2SV_ModStart> , _ ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>cache<S2SV_blank>“%s”:" <S2SV_ModEnd> ) , filename |
1,168 | CWE-000 int send_file ( int sock_fd , char * path ) { int i ; char msg [ MSG_LEN ] ; FILE * fp ; long fsize ; char ch_current ; int eof_reached = 0 ; fp = fopen ( path , "r" ) ; if ( fp == NULL ) { perror ( "fopen" ) ; return - 1 ; } fseek ( fp , 0 , SEEK_END ) ; fsize = ftell ( fp ) ; rewind ( fp ) ; send_int ( sock_fd , fsize ) ; while ( fsize > 0 ) { for ( i = 0 ; i < MSG_LEN ; i ++ ) { ch_current = fgetc ( fp ) ; if ( ch_current == EOF ) { i -- ; eof_reached = 1 ; break ; } } if ( i >= 0 ) { <S2SV_StartBug> if ( respond ( sock_fd , msg , i + 1 ) ) { <S2SV_EndBug> printf ( "Unable<S2SV_blank>to<S2SV_blank>send<S2SV_blank>requested<S2SV_blank>file:<S2SV_blank>%s" , path ) ; fclose ( fp ) ; return - 1 ; } fsize -= i + 1 ; } if ( eof_reached ) { break ; } } fclose ( fp ) ; return 0 ; } | <S2SV_ModStart> { if ( send_msg <S2SV_ModEnd> ( sock_fd , |
1,169 | CWE-000 static ssize_t frac_latitude_store ( struct kobject * kobj , struct kobj_attribute * attr , const char * buf , size_t count ) { <S2SV_StartBug> sscanf ( buf , "%d" , & ugeo -> frac_lat ) ; <S2SV_EndBug> return count ; } | <S2SV_ModStart> count ) { if ( buf == '\\0' ) buf = 0x00000000 ; |
1,170 | CWE-000 void defragmentArr ( struct Requests reqArr [ ] , int arrLength ) { int c = 0 ; <S2SV_StartBug> for ( int i = 0 ; i < arrLength ) { <S2SV_EndBug> if ( reqArr [ i ] . isReq ) { reqArr [ c ] = reqArr [ i ] ; <S2SV_StartBug> reqArr [ i ] . isReq = 0 ; <S2SV_EndBug> c ++ ; } } } | <S2SV_ModStart> i < arrLength ; i ++ <S2SV_ModStart> i ] ; if ( c != i ) |
1,171 | CWE-000 void readDictionary ( char * filename ) { int c ; c = 0 ; char * word ; char * key ; int len = 70 ; word = malloc ( ( len + 1 ) * sizeof ( char ) ) ; int i ; i = 0 ; FILE * fin ; fin = fopen ( filename , "r" ) ; if ( fin != NULL ) { while ( c != EOF ) { c = getc ( fin ) ; if ( isalpha ( c ) && c != '\\n' ) { word [ i ] = c ; i ++ ; <S2SV_StartBug> if ( ( i == ( len - 1 ) ) ) { <S2SV_EndBug> len += 70 ; word = realloc ( word , ( ( len ) * sizeof ( char ) ) ) ; } } else { word [ i ] = '\\0' ; i = 0 ; len = 70 ; key = malloc ( ( strlen ( word ) + 1 ) * sizeof ( char ) ) ; strcpy ( key , word ) ; insertData ( dictionary , key , word ) ; } } fclose ( fin ) ; } else { printf ( "Sorry,<S2SV_blank>no<S2SV_blank>file<S2SV_blank>found" ) ; } free ( word ) ; } | <S2SV_ModStart> ; if ( i > <S2SV_ModEnd> ( len - <S2SV_ModStart> ( len - 2 <S2SV_ModEnd> ) ) { |
1,172 | CWE-000 void delete_shared_memory ( t_env * env ) { if ( munmap ( env -> shared , sizeof ( t_shared ) ) == - 1 ) perr_exit ( "munmap" ) ; sem_unlink ( SEM_BOARD ) ; shm_unlink ( SHARED_BOARD ) ; <S2SV_StartBug> printf ( "delete<S2SV_blank>shared<S2SV_blank>memory\\n" ) ; <S2SV_EndBug> } | <S2SV_ModStart> SHARED_BOARD ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
1,173 | CWE-000 static void _do_grid_grazing_EndOfYear ( int row , int col ) { if ( UseDisturbances ) { IntU grazingyr = 0 ; int cell = col + ( ( row - 1 ) * grid_Cols ) - 1 ; if ( ( Globals . currYear >= grid_Disturb [ cell ] . grazingfreq_startyr ) && GT ( grid_Disturb [ cell ] . grazing_frq , 0. ) ) { if ( LT ( grid_Disturb [ cell ] . grazing_frq , 1.0 ) ) { <S2SV_StartBug> if ( RandUni ( ) <= grid_Disturb [ cell ] . grazing_frq ) <S2SV_EndBug> { grazingyr = Globals . currYear ; } } else if ( ( ( Globals . currYear - grid_Disturb [ cell ] . grazingfreq_startyr ) % ( IntU ) grid_Disturb [ cell ] . grazing_frq ) == 0 ) { grazingyr = Globals . currYear ; } } if ( Globals . currYear == grazingyr ) { GrpIndex rg ; ForEachGroup ( rg ) { if ( Globals . currYear < RGroup [ rg ] -> startyr ) { continue ; } Int i ; ForEachEstSpp2 ( rg , i ) { if ( ! Species [ RGroup [ rg ] -> est_spp [ i ] ] -> use_me ) { continue ; } else { Species_Proportion_Grazing ( RGroup [ rg ] -> est_spp [ i ] , RGroup [ rg ] -> proportion_grazing ) ; } } } } } } | <S2SV_ModStart> ( RandUni ( & grid_rng |
1,174 | CWE-000 void lay_pipe ( t_cmd * cmds ) { int lpipe [ 2 ] ; <S2SV_StartBug> int rpipe [ 2 ] ; <S2SV_EndBug> int status ; pipe ( rpipe ) ; fork_and_chain ( cmds , NULL , rpipe ) ; lpipe [ 0 ] = rpipe [ 0 ] ; lpipe [ 1 ] = rpipe [ 1 ] ; while ( cmds -> next ) { pipe ( rpipe ) ; fork_and_chain ( cmds , lpipe , rpipe ) ; close ( lpipe [ 0 ] ) ; close ( lpipe [ 1 ] ) ; lpipe [ 0 ] = rpipe [ 0 ] ; lpipe [ 1 ] = rpipe [ 1 ] ; cmds = cmds -> next ; } fork_and_chain ( cmds , lpipe , NULL ) ; close ( lpipe [ 0 ] ) ; close ( lpipe [ 1 ] ) ; <S2SV_StartBug> wait ( & status ) ; <S2SV_EndBug> } | <S2SV_ModStart> [ 2 ] <S2SV_ModEnd> ; pipe ( <S2SV_ModStart> ] ) ; waitpid ( - 1 , NULL , 0 <S2SV_ModEnd> ) ; } |
1,175 | CWE-000 Laik_Partitioning * laik_new_partitioning ( Laik_Space * s ) { Laik_Partitioning * p ; p = ( Laik_Partitioning * ) malloc ( sizeof ( Laik_Partitioning ) ) ; p -> id = part_id ++ ; p -> name = strdup ( "partng-0<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" ) ; sprintf ( p -> name , "partng-%d" , p -> id ) ; p -> space = s ; p -> next = s -> first_partitioning ; s -> first_partitioning = p ; p -> permission = LAIK_AP_None ; p -> type = LAIK_PT_None ; p -> group = laik_world ( s -> inst ) ; p -> pdim = 0 ; p -> getIdxW = 0 ; <S2SV_StartBug> p -> base = 0 ; <S2SV_EndBug> p -> haloWidth = 0 ; p -> bordersValid = false ; p -> borders = 0 ; return p ; } | <S2SV_ModStart> ; p -> idxUserData = 0 ; p -> getTaskW = 0 ; p -> taskUserData = 0 ; p -> |
1,176 | CWE-000 static void efa_setup_channel ( struct ata_channel * chp ) { int drive , chnum ; uint8_t mode ; struct atac_softc * atac ; struct ata_drive_datas * drvp ; struct efa_softc * sc ; int ipl ; # ifdef EFA_DEBUG device_t self ; # endif chnum = chp -> ch_channel ; atac = chp -> ch_atac ; sc = device_private ( atac -> atac_dev ) ; mode = 5 ; # ifdef EFA_DEBUG self = sc -> sc_wdcdev . sc_atac . atac_dev ; aprint_normal_dev ( self , "efa_setup_channel<S2SV_blank>for<S2SV_blank>ch<S2SV_blank>%d\\n" , chnum ) ; # endif ipl = splvm ( ) ; for ( drive = 0 ; drive < 2 ; drive ++ ) { drvp = & chp -> ch_drive [ drive ] ; if ( drvp -> drive_type == ATA_DRIVET_NONE ) continue ; if ( drvp -> PIO_cap < mode ) mode = drvp -> PIO_cap ; # ifdef EFA_DEBUG aprint_normal_dev ( self , "drive<S2SV_blank>%d<S2SV_blank>supports<S2SV_blank>%d\\n" , drive , drvp -> PIO_cap ) ; # endif drvp -> PIO_mode = mode ; } efa_select_regset ( sc , chnum , mode ) ; <S2SV_StartBug> wdc_init_shadow_regs ( & sc -> sc_ports [ chnum ] . chan ) ; <S2SV_EndBug> splx ( ipl ) ; } | <S2SV_ModStart> ; wdc_init_shadow_regs ( CHAN_TO_WDC_REGS ( <S2SV_ModStart> . chan ) ) |
1,177 | CWE-000 static int rte_init ( void ) { int ret ; <S2SV_StartBug> char * error = NULL ; <S2SV_EndBug> char * * hosts = NULL ; if ( ORTE_SUCCESS != ( ret = orte_ess_base_std_prolog ( ) ) ) { error = "orte_ess_base_std_prolog" ; goto error ; } env_set_name ( ) ; <S2SV_StartBug> if ( NULL != orte_node_regex ) { <S2SV_EndBug> if ( ORTE_SUCCESS != ( ret = orte_regex_extract_node_names ( orte_node_regex , & hosts ) ) ) { error = "orte_regex_extract_node_names" ; goto error ; } } <S2SV_StartBug> if ( ORTE_SUCCESS != ( ret = orte_ess_base_orted_setup ( hosts ) ) ) { <S2SV_EndBug> ORTE_ERROR_LOG ( ret ) ; error = "orte_ess_base_orted_setup" ; goto error ; } <S2SV_StartBug> opal_argv_free ( hosts ) ; <S2SV_EndBug> return ORTE_SUCCESS ; error : if ( ORTE_ERR_SILENT != ret && ! orte_report_silent_errors ) { orte_show_help ( "help-orte-runtime.txt" , "orte_init:startup:internal-failure" , true , error , ORTE_ERROR_NAME ( ret ) , ret ) ; } return ret ; } | <S2SV_ModStart> char * error <S2SV_ModEnd> = NULL ; <S2SV_ModStart> ; if ( <S2SV_ModEnd> ORTE_SUCCESS != ( <S2SV_ModStart> = orte_ess_base_orted_setup ( <S2SV_ModEnd> ) ) ) <S2SV_ModStart> error ; } <S2SV_ModEnd> return ORTE_SUCCESS ; |
1,178 | CWE-000 int method_setdpms ( sd_bus_message * m , void * userdata , sd_bus_error * ret_error ) { const char * card = NULL ; struct udev_device * dev = NULL ; <S2SV_StartBug> int level ; <S2SV_EndBug> if ( ! check_authorization ( m ) ) { sd_bus_error_set_errno ( ret_error , EPERM ) ; return - EPERM ; } int r = sd_bus_message_read ( m , "si" , & card , & level ) ; if ( r < 0 ) { fprintf ( stderr , "Failed<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>parameters:<S2SV_blank>%s\\n" , strerror ( - r ) ) ; return r ; } if ( level < 0 || level > 3 ) { sd_bus_error_set_const ( ret_error , SD_BUS_ERROR_FAILED , "Wrong<S2SV_blank>DPMS<S2SV_blank>level<S2SV_blank>value." ) ; return - EINVAL ; } get_udev_device ( card , "drm" , & ret_error , & dev ) ; if ( sd_bus_error_is_set ( ret_error ) ) { return - sd_bus_error_get_errno ( ret_error ) ; } <S2SV_StartBug> drm_set_dpms ( level , udev_device_get_devnode ( dev ) ) ; <S2SV_EndBug> udev_device_unref ( dev ) ; <S2SV_StartBug> printf ( "New<S2SV_blank>dpms<S2SV_blank>state:<S2SV_blank>%d\\n" , level ) ; <S2SV_EndBug> return sd_bus_reply_method_return ( m , "i" , level ) ; } | <S2SV_ModStart> ; int level , error = 0 <S2SV_ModStart> ( dev ) , & error <S2SV_ModStart> dev ) ; if ( error ) { sd_bus_error_set_errno ( ret_error , error ) ; return - error ; } |
1,179 | CWE-000 int DCRYPTO_rsa_sign ( struct RSA * rsa , uint8_t * out , uint32_t * out_len , const uint8_t * in , const uint32_t in_len , enum padding_mode padding , enum hashing_mode hashing ) { uint32_t padded_buf [ RSA_MAX_WORDS ] ; struct LITE_BIGNUM padded ; struct LITE_BIGNUM signature ; if ( ! check_modulus_params ( & rsa -> N , sizeof ( padded_buf ) , out_len ) ) return 0 ; bn_init ( & padded , padded_buf , bn_size ( & rsa -> N ) ) ; bn_init ( & signature , out , bn_size ( & rsa -> N ) ) ; switch ( padding ) { case PADDING_MODE_PKCS1 : if ( ! pkcs1_type1_pad ( ( uint8_t * ) padded . d , bn_size ( & padded ) , ( const uint8_t * ) in , in_len , hashing ) ) return 0 ; break ; case PADDING_MODE_PSS : if ( ! pkcs1_pss_pad ( ( uint8_t * ) padded . d , bn_size ( & padded ) , ( const uint8_t * ) in , in_len , hashing ) ) return 0 ; break ; default : return 0 ; } reverse ( ( uint8_t * ) padded . d , bn_size ( & padded ) ) ; bn_mont_modexp ( & signature , & padded , & rsa -> d , & rsa -> N ) ; reverse ( ( uint8_t * ) signature . d , bn_size ( & signature ) ) ; * out_len = bn_size ( & rsa -> N ) ; <S2SV_StartBug> dcrypto_memset ( padded_buf , 0 , sizeof ( padded_buf ) ) ; <S2SV_EndBug> return 1 ; } | <S2SV_ModStart> N ) ; always_memset <S2SV_ModEnd> ( padded_buf , |
1,180 | CWE-000 <S2SV_StartBug> AH_DIALOG * AH_Dialog_new ( AB_USER * u ) { <S2SV_EndBug> AH_DIALOG * dlg ; AH_HBCI * h ; GWEN_BUFFER * pbuf ; assert ( u ) ; h = AH_User_GetHbci ( u ) ; GWEN_NEW_OBJECT ( AH_DIALOG , dlg ) ; dlg -> usage = 1 ; dlg -> globalValues = GWEN_DB_Group_new ( "globalValues" ) ; dlg -> dialogId = strdup ( "0" ) ; dlg -> msgEngine = AH_User_GetMsgEngine ( u ) ; <S2SV_StartBug> GWEN_MsgEngine_Attach ( dlg -> msgEngine ) ; <S2SV_EndBug> dlg -> dialogOwner = u ; pbuf = GWEN_Buffer_new ( 0 , 256 , 0 , 1 ) ; if ( AH_HBCI_AddBankPath ( h , u , pbuf ) ) { DBG_ERROR ( AQHBCI_LOGDOMAIN , "Could<S2SV_blank>not<S2SV_blank>add<S2SV_blank>bank<S2SV_blank>path,<S2SV_blank>cannot<S2SV_blank>log" ) ; GWEN_Buffer_free ( pbuf ) ; } else { GWEN_Buffer_AppendString ( pbuf , AH_PATH_SEP "logs" AH_PATH_SEP ) ; AH_HBCI_AppendUniqueName ( h , pbuf ) ; GWEN_Buffer_AppendString ( pbuf , ".log" ) ; dlg -> logName = strdup ( GWEN_Buffer_GetStart ( pbuf ) ) ; } GWEN_Buffer_free ( pbuf ) ; return dlg ; } | <S2SV_ModStart> AB_USER * u , AB_PROVIDER * pro <S2SV_ModStart> -> msgEngine ) ; dlg -> provider = pro |
1,181 | CWE-000 otError otPlatRadioTransmit ( otInstance * aInstance , otRadioFrame * aPacket ) { ( void ) aInstance ; ( void ) aPacket ; pkt . iov_base = sTransmitFrame . mPsdu ; pkt . iov_len = sTransmitFrame . mLength - RADIO_IEEE802154_FCS_LEN ; int success = - 1 ; mutex_lock ( openthread_get_radio_mutex ( ) ) ; printf ( "try->" ) ; success = _dev -> driver -> send ( _dev , & pkt , 1 ) ; printf ( "done<S2SV_blank>%d\\n" , success ) ; if ( success == - 1 ) { if ( _get_state ( ) != NETOPT_STATE_RX ) { _set_idle ( ) ; } mutex_unlock ( openthread_get_radio_mutex ( ) ) ; <S2SV_StartBug> msg_t msg ; <S2SV_EndBug> msg . type = OPENTHREAD_NETDEV_MSG_TYPE_RADIO_BUSY ; <S2SV_StartBug> msg_send ( & msg , openthread_get_task_pid ( ) ) ; <S2SV_EndBug> } else { mutex_unlock ( openthread_get_radio_mutex ( ) ) ; } return OT_ERROR_NONE ; } | <S2SV_ModStart> ) ) ; <S2SV_ModEnd> msg . type <S2SV_ModStart> = OPENTHREAD_NETDEV_MSG_TYPE_RADIO_BUSY ; msg_send_to_self <S2SV_ModEnd> ( & msg <S2SV_ModStart> ( & msg <S2SV_ModEnd> ) ; } |
1,182 | CWE-000 static PyObject * pycairo_get_antialias ( PycairoContext * o ) { <S2SV_StartBug> return PYCAIRO_PyLong_FromLong ( cairo_get_antialias ( o -> ctx ) ) ; <S2SV_EndBug> } | <S2SV_ModStart> o ) { RETURN_INT_ENUM ( Antialias , <S2SV_ModEnd> cairo_get_antialias ( o |
1,183 | CWE-000 static int unforce_rtp_proxy ( struct sip_msg * msg , char * flags ) { str callid , from_tag , to_tag , viabranch ; char * cp ; int via = 0 ; int to = 1 ; int extra = 0 ; str extra_id ; int ret ; struct rtpp_node * node ; struct iovec v [ 1 + 4 + 3 + 2 ] = { { NULL , 0 } , { "D" , 1 } , { "<S2SV_blank>" , 1 } , { NULL , 0 } , { NULL , 0 } , { NULL , 0 } , { "<S2SV_blank>" , 1 } , { NULL , 0 } , { "<S2SV_blank>" , 1 } , { NULL , 0 } } ; <S2SV_StartBug> for ( cp = flags ; cp && * cp ; cp ++ ) { <S2SV_EndBug> switch ( * cp ) { case '1' : via = 1 ; break ; case '2' : via = 2 ; break ; case '3' : <S2SV_StartBug> if ( msg && msg -> first_line . type == SIP_REPLY ) <S2SV_EndBug> via = 2 ; else via = 1 ; break ; case 't' : case 'T' : to = 0 ; break ; case 'b' : extra = 1 ; break ; case 'a' : case 'A' : case 'i' : case 'I' : case 'e' : case 'E' : case 'l' : case 'L' : case 'f' : case 'F' : case 'r' : case 'R' : case 'c' : case 'C' : case 'o' : case 'O' : case 'x' : case 'X' : case 'w' : case 'W' : case 'z' : case 'Z' : break ; default : LM_ERR ( "unknown<S2SV_blank>option<S2SV_blank>`%c\'\\n" , * cp ) ; return - 1 ; } } if ( get_callid ( msg , & callid ) == - 1 || callid . len == 0 ) { LM_ERR ( "can\'t<S2SV_blank>get<S2SV_blank>Call-Id<S2SV_blank>field\\n" ) ; return - 1 ; } to_tag . s = 0 ; to_tag . len = 0 ; if ( ( to == 1 ) && get_to_tag ( msg , & to_tag ) == - 1 ) { LM_ERR ( "can\'t<S2SV_blank>get<S2SV_blank>To<S2SV_blank>tag\\n" ) ; return - 1 ; } if ( get_from_tag ( msg , & from_tag ) == - 1 || from_tag . len == 0 ) { LM_ERR ( "can\'t<S2SV_blank>get<S2SV_blank>From<S2SV_blank>tag\\n" ) ; return - 1 ; } if ( via ) { if ( via == 1 ) ret = get_via_branch ( msg , 1 , & viabranch ) ; else ret = get_via_branch ( msg , 2 , & viabranch ) ; if ( ret == - 1 || viabranch . len == 0 ) { LM_ERR ( "can\'t<S2SV_blank>get<S2SV_blank>Via<S2SV_blank>branch\\n" ) ; return - 1 ; } v [ 4 ] . iov_base = ";" ; v [ 4 ] . iov_len = 1 ; STR2IOVEC ( viabranch , v [ 5 ] ) ; } else if ( extra && extra_id_pv && get_extra_id ( msg , & extra_id ) ) { v [ 4 ] . iov_base = ";" ; v [ 4 ] . iov_len = 1 ; STR2IOVEC ( extra_id , v [ 5 ] ) ; } STR2IOVEC ( callid , v [ 3 ] ) ; STR2IOVEC ( from_tag , v [ 7 ] ) ; STR2IOVEC ( to_tag , v [ 9 ] ) ; if ( msg -> id != current_msg_id ) { selected_rtpp_set = default_rtpp_set ; } node = select_rtpp_node ( callid , 1 ) ; if ( ! node ) { LM_ERR ( "no<S2SV_blank>available<S2SV_blank>proxies\\n" ) ; return - 1 ; } set_rtp_inst_pvar ( msg , & node -> rn_url ) ; send_rtpp_command ( node , v , ( to_tag . len > 0 ) ? 10 : 8 ) ; return 1 ; } | <S2SV_ModStart> } } ; if ( msg == NULL ) { LM_ERR ( "invalid<S2SV_blank>sip<S2SV_blank>message<S2SV_blank>structure\\n" ) ; return - 1 ; } <S2SV_ModStart> : if ( <S2SV_ModEnd> msg -> first_line |
1,184 | CWE-000 void init_net_state_privileged ( struct net_state_t * net_state ) { int ip4_err = 0 ; int ip6_err = 0 ; memset ( net_state , 0 , sizeof ( struct net_state_t ) ) ; net_state -> platform . next_sequence = MIN_PORT ; if ( open_ip4_sockets_raw ( net_state ) ) { # ifdef HAVE_LINUX_ERRQUEUE_H if ( open_ip4_sockets_dgram ( net_state ) ) { ip4_err = errno ; } # endif } if ( open_ip6_sockets_raw ( net_state ) ) { # ifdef HAVE_LINUX_ERRQUEUE_H if ( open_ip6_sockets_dgram ( net_state ) ) { ip6_err = errno ; } # endif } if ( ! net_state -> platform . ip4_present && ! net_state -> platform . ip6_present ) { <S2SV_StartBug> errno = ip4_err ; <S2SV_EndBug> perror ( "Failure<S2SV_blank>to<S2SV_blank>open<S2SV_blank>IPv4<S2SV_blank>sockets" ) ; <S2SV_StartBug> errno = ip6_err ; <S2SV_EndBug> perror ( "Failure<S2SV_blank>to<S2SV_blank>open<S2SV_blank>IPv6<S2SV_blank>sockets" ) ; exit ( EXIT_FAILURE ) ; } } | <S2SV_ModStart> ip6_present ) { error ( 0 , ip4_err , <S2SV_ModEnd> "Failure<S2SV_blank>to<S2SV_blank>open<S2SV_blank>IPv4<S2SV_blank>sockets" ) ; <S2SV_ModStart> "Failure<S2SV_blank>to<S2SV_blank>open<S2SV_blank>IPv4<S2SV_blank>sockets" ) ; error ( 0 , ip6_err , <S2SV_ModEnd> "Failure<S2SV_blank>to<S2SV_blank>open<S2SV_blank>IPv6<S2SV_blank>sockets" ) ; |
1,185 | CWE-000 int replace_page_cache_page ( struct page * old , struct page * new , gfp_t gfp_mask ) { int error ; VM_BUG_ON_PAGE ( ! PageLocked ( old ) , old ) ; VM_BUG_ON_PAGE ( ! PageLocked ( new ) , new ) ; VM_BUG_ON_PAGE ( new -> mapping , new ) ; <S2SV_StartBug> error = radix_tree_preload ( gfp_mask & ~ __GFP_HIGHMEM ) ; <S2SV_EndBug> if ( ! error ) { struct address_space * mapping = old -> mapping ; void ( * freepage ) ( struct page * ) ; unsigned long flags ; pgoff_t offset = old -> index ; freepage = mapping -> a_ops -> freepage ; get_page ( new ) ; new -> mapping = mapping ; new -> index = offset ; spin_lock_irqsave ( & mapping -> tree_lock , flags ) ; __delete_from_page_cache ( old , NULL ) ; error = page_cache_tree_insert ( mapping , new , NULL ) ; BUG_ON ( error ) ; if ( ! PageHuge ( new ) ) __inc_node_page_state ( new , NR_FILE_PAGES ) ; if ( PageSwapBacked ( new ) ) __inc_node_page_state ( new , NR_SHMEM ) ; spin_unlock_irqrestore ( & mapping -> tree_lock , flags ) ; mem_cgroup_migrate ( old , new ) ; radix_tree_preload_end ( ) ; if ( freepage ) freepage ( old ) ; put_page ( old ) ; } return error ; } | <S2SV_ModStart> ( gfp_mask & GFP_RECLAIM_MASK <S2SV_ModEnd> ) ; if |
1,186 | CWE-000 clusterNode * getNodeByQuery ( redisClient * c , struct redisCommand * cmd , robj * * argv , int argc , int * hashslot , int * error_code ) { clusterNode * n = NULL ; robj * firstkey = NULL ; int multiple_keys = 0 ; multiState * ms , _ms ; multiCmd mc ; int i , slot = 0 , migrating_slot = 0 , importing_slot = 0 , missing_keys = 0 ; if ( error_code ) * error_code = REDIS_CLUSTER_REDIR_NONE ; if ( cmd -> proc == execCommand ) { if ( ! ( c -> flags & REDIS_MULTI ) ) return myself ; ms = & c -> mstate ; } else { ms = & _ms ; _ms . commands = & mc ; _ms . count = 1 ; mc . argv = argv ; mc . argc = argc ; mc . cmd = cmd ; } for ( i = 0 ; i < ms -> count ; i ++ ) { struct redisCommand * mcmd ; robj * * margv ; int margc , * keyindex , numkeys , j ; mcmd = ms -> commands [ i ] . cmd ; margc = ms -> commands [ i ] . argc ; margv = ms -> commands [ i ] . argv ; keyindex = getKeysFromCommand ( mcmd , margv , margc , & numkeys ) ; for ( j = 0 ; j < numkeys ; j ++ ) { robj * thiskey = margv [ keyindex [ j ] ] ; int thisslot = keyHashSlot ( ( char * ) thiskey -> ptr , sdslen ( thiskey -> ptr ) ) ; if ( firstkey == NULL ) { firstkey = thiskey ; slot = thisslot ; n = server . cluster -> slots [ slot ] ; if ( n == NULL ) { getKeysFreeResult ( keyindex ) ; if ( error_code ) * error_code = REDIS_CLUSTER_REDIR_DOWN_UNBOUND ; return NULL ; } if ( n == myself && server . cluster -> migrating_slots_to [ slot ] != NULL ) { migrating_slot = 1 ; } else if ( server . cluster -> importing_slots_from [ slot ] != NULL ) { importing_slot = 1 ; } } else { if ( ! equalStringObjects ( firstkey , thiskey ) ) { if ( slot != thisslot ) { getKeysFreeResult ( keyindex ) ; if ( error_code ) * error_code = REDIS_CLUSTER_REDIR_CROSS_SLOT ; return NULL ; } else { multiple_keys = 1 ; } } } if ( ( migrating_slot || importing_slot ) && lookupKeyRead ( & server . db [ 0 ] , thiskey ) == NULL ) { missing_keys ++ ; } } getKeysFreeResult ( keyindex ) ; } if ( n == NULL ) return myself ; if ( hashslot ) * hashslot = slot ; <S2SV_StartBug> if ( migrating_slot && missing_keys && cmd -> proc != migrateCommand ) { <S2SV_EndBug> if ( error_code ) * error_code = REDIS_CLUSTER_REDIR_ASK ; return server . cluster -> migrating_slots_to [ slot ] ; } if ( importing_slot && ( c -> flags & REDIS_ASKING || cmd -> flags & REDIS_CMD_ASKING ) ) { if ( multiple_keys && missing_keys ) { if ( error_code ) * error_code = REDIS_CLUSTER_REDIR_UNSTABLE ; return NULL ; } else { return myself ; } } if ( c -> flags & REDIS_READONLY && cmd -> flags & REDIS_CMD_READONLY && nodeIsSlave ( myself ) && myself -> slaveof == n ) { return myself ; } if ( n != myself && error_code ) * error_code = REDIS_CLUSTER_REDIR_MOVED ; return n ; } | <S2SV_ModStart> ; if ( ( migrating_slot || importing_slot ) && cmd -> proc == migrateCommand ) return myself ; if ( migrating_slot && missing_keys <S2SV_ModEnd> ) { if |
1,187 | CWE-000 static ml_value_t * target_expr_stringify ( void * Data , int Count , ml_value_t * * Args ) { ml_stringbuffer_t * Buffer = ( ml_stringbuffer_t * ) Args [ 0 ] ; <S2SV_StartBug> target_expr_t * Target = ( target_expr_t * ) Args [ 1 ] ; <S2SV_EndBug> <S2SV_StartBug> target_wait ( ( target_t * ) Target ) ; <S2SV_EndBug> <S2SV_StartBug> target_depends_auto ( ( target_t * ) Target ) ; <S2SV_EndBug> <S2SV_StartBug> ml_value_t * Value = cache_expr_get ( ( target_t * ) Target ) ; <S2SV_EndBug> return ml_inline ( AppendMethod , 2 , Buffer , Value ) ; } | <S2SV_ModStart> 0 ] ; target_t <S2SV_ModEnd> * Target = <S2SV_ModStart> Target = ( target_t <S2SV_ModEnd> * ) Args <S2SV_ModStart> ; target_wait ( <S2SV_ModEnd> Target ) ; <S2SV_ModStart> ; target_depends_auto ( <S2SV_ModEnd> Target ) ; <S2SV_ModStart> = cache_expr_get ( <S2SV_ModEnd> Target ) ; |
1,188 | CWE-000 sb_event_t file_get_rnd_request ( int thread_id ) { sb_event_t sb_req ; sb_file_request_t * file_req = & sb_req . u . file_request ; unsigned long long tmppos ; int real_mode = test_mode ; int mode = test_mode ; unsigned int i ; sb_req . type = SB_REQ_TYPE_FILE ; <S2SV_StartBug> SB_THREAD_MUTEX_LOCK ( ) ; <S2SV_EndBug> if ( test_mode == MODE_RND_RW ) { <S2SV_StartBug> if ( ( double ) ( read_ops + 1 ) / ( write_ops + 1 ) < file_rw_ratio ) <S2SV_EndBug> mode = MODE_RND_READ ; else mode = MODE_RND_WRITE ; <S2SV_StartBug> } <S2SV_EndBug> if ( max_events > 0 && req_performed >= max_events ) { if ( file_fsync_end != 0 && ( real_mode == MODE_RND_WRITE || real_mode == MODE_RND_RW || real_mode == MODE_MIXED ) ) { if ( fsynced_file2 < num_files ) { file_req -> file_id = fsynced_file2 ; file_req -> operation = FILE_OP_TYPE_FSYNC ; file_req -> pos = 0 ; file_req -> size = 0 ; fsynced_file2 ++ ; SB_THREAD_MUTEX_UNLOCK ( ) ; return sb_req ; } } sb_req . type = SB_REQ_TYPE_NULL ; SB_THREAD_MUTEX_UNLOCK ( ) ; return sb_req ; } if ( file_fsync_freq != 0 && is_dirty ) { if ( req_performed % file_fsync_freq == 0 ) { file_req -> operation = FILE_OP_TYPE_FSYNC ; file_req -> file_id = fsynced_file ; file_req -> pos = 0 ; file_req -> size = 0 ; fsynced_file ++ ; if ( fsynced_file == num_files ) { fsynced_file = 0 ; is_dirty = 0 ; } SB_THREAD_MUTEX_UNLOCK ( ) ; return sb_req ; } } if ( mode == MODE_RND_WRITE ) file_req -> operation = FILE_OP_TYPE_WRITE ; else file_req -> operation = FILE_OP_TYPE_READ ; retry : tmppos = ( long long ) ( sb_rand_uniform_double ( ) * total_size ) ; tmppos = tmppos - ( tmppos % ( long long ) file_block_size ) ; file_req -> file_id = ( int ) ( tmppos / ( long long ) file_size ) ; file_req -> pos = ( long long ) ( tmppos % ( long long ) file_size ) ; file_req -> size = file_block_size ; if ( sb_globals . validate ) { for ( i = 0 ; i < sb_globals . threads ; i ++ ) { if ( i != ( unsigned ) thread_id && per_thread [ i ] . buffer_file_id == file_req -> file_id && per_thread [ i ] . buffer_pos == file_req -> pos ) goto retry ; } } per_thread [ thread_id ] . buffer_file_id = file_req -> file_id ; per_thread [ thread_id ] . buffer_pos = file_req -> pos ; req_performed ++ ; if ( file_req -> operation == FILE_OP_TYPE_WRITE ) is_dirty = 1 ; SB_THREAD_MUTEX_UNLOCK ( ) ; return sb_req ; } | <S2SV_ModStart> = SB_REQ_TYPE_FILE ; <S2SV_ModEnd> if ( test_mode <S2SV_ModStart> MODE_RND_RW ) { mode = ( sb_counter_val ( thread_id , SB_CNT_READ ) + 1.0 ) / ( sb_counter_val ( thread_id , SB_CNT_WRITE ) + 1.0 <S2SV_ModEnd> ) < file_rw_ratio <S2SV_ModStart> ) < file_rw_ratio ? MODE_RND_READ : <S2SV_ModEnd> MODE_RND_WRITE ; } <S2SV_ModStart> MODE_RND_WRITE ; } SB_THREAD_MUTEX_LOCK ( ) ; |
1,189 | CWE-000 int main ( void ) { if ( InitHardware ( ) ) printf ( "Hardware<S2SV_blank>init<S2SV_blank>failed!\\n\\r" ) ; else printf ( "Hardware<S2SV_blank>init<S2SV_blank>ok!\\n\\r" ) ; vRadio_Init ( ) ; printf ( "Program<S2SV_blank>started!\\n\\r" ) ; while ( 1 ) <S2SV_StartBug> sleep ( 10000 ) ; <S2SV_EndBug> return 0 ; } | <S2SV_ModStart> ( 1 ) { vRadio_StartTx ( 0 , ( uint8_t * ) 0xff ) ; sleep ( 1 ) ; } <S2SV_ModEnd> return 0 ; |
1,190 | CWE-000 u32 sbrk ( process_t * process , u32 incr ) { u32 new_last_addr = process -> heap_addr + process -> heap_size + incr ; if ( ! is_mapped ( new_last_addr , process -> page_directory ) ) { <S2SV_StartBug> map_memory_if_not_mapped ( incr , process -> heap_addr + process -> heap_size , process -> page_directory ) ; <S2SV_EndBug> } process -> heap_size += incr ; return process -> heap_addr + process -> heap_size ; } | <S2SV_ModStart> ) ) { # ifdef PAGING_DEBUG kprintf ( "%lSBRK:<S2SV_blank>mappping<S2SV_blank>if<S2SV_blank>not<S2SV_blank>0x%X<S2SV_blank>(size<S2SV_blank>0x%X)...\\n" , 3 , process -> heap_addr + process -> heap_size , incr ) ; # endif |
1,191 | CWE-000 static int update_array_info ( struct mddev * mddev , mdu_array_info_t * info ) { int rv = 0 ; int cnt = 0 ; int state = 0 ; if ( mddev -> bitmap && mddev -> bitmap_info . offset ) state |= ( 1 << MD_SB_BITMAP_PRESENT ) ; if ( mddev -> major_version != info -> major_version || mddev -> minor_version != info -> minor_version || mddev -> ctime != info -> ctime || mddev -> level != info -> level || <S2SV_StartBug> ! mddev -> persistent != info -> not_persistent || <S2SV_EndBug> mddev -> chunk_sectors != info -> chunk_size >> 9 || ( ( state ^ info -> state ) & 0xfffffe00 ) ) return - EINVAL ; if ( info -> size >= 0 && mddev -> dev_sectors / 2 != info -> size ) cnt ++ ; if ( mddev -> raid_disks != info -> raid_disks ) cnt ++ ; if ( mddev -> layout != info -> layout ) cnt ++ ; if ( ( state ^ info -> state ) & ( 1 << MD_SB_BITMAP_PRESENT ) ) cnt ++ ; if ( cnt == 0 ) return 0 ; if ( cnt > 1 ) return - EINVAL ; if ( mddev -> layout != info -> layout ) { if ( mddev -> pers -> check_reshape == NULL ) return - EINVAL ; else { mddev -> new_layout = info -> layout ; rv = mddev -> pers -> check_reshape ( mddev ) ; if ( rv ) mddev -> new_layout = mddev -> layout ; return rv ; } } if ( info -> size >= 0 && mddev -> dev_sectors / 2 != info -> size ) rv = update_size ( mddev , ( sector_t ) info -> size * 2 ) ; if ( mddev -> raid_disks != info -> raid_disks ) rv = update_raid_disks ( mddev , info -> raid_disks ) ; if ( ( state ^ info -> state ) & ( 1 << MD_SB_BITMAP_PRESENT ) ) { if ( mddev -> pers -> quiesce == NULL || mddev -> thread == NULL ) return - EINVAL ; if ( mddev -> recovery || mddev -> sync_thread ) return - EBUSY ; if ( info -> state & ( 1 << MD_SB_BITMAP_PRESENT ) ) { if ( mddev -> bitmap ) return - EEXIST ; if ( mddev -> bitmap_info . default_offset == 0 ) return - EINVAL ; mddev -> bitmap_info . offset = mddev -> bitmap_info . default_offset ; mddev -> bitmap_info . space = mddev -> bitmap_info . default_space ; mddev -> pers -> quiesce ( mddev , 1 ) ; rv = bitmap_create ( mddev ) ; if ( ! rv ) rv = bitmap_load ( mddev ) ; if ( rv ) bitmap_destroy ( mddev ) ; mddev -> pers -> quiesce ( mddev , 0 ) ; } else { if ( ! mddev -> bitmap ) return - ENOENT ; if ( mddev -> bitmap -> storage . file ) return - EINVAL ; mddev -> pers -> quiesce ( mddev , 1 ) ; bitmap_destroy ( mddev ) ; mddev -> pers -> quiesce ( mddev , 0 ) ; mddev -> bitmap_info . offset = 0 ; } } md_update_sb ( mddev , 1 ) ; return rv ; } | <S2SV_ModStart> -> level || mddev -> persistent != ! <S2SV_ModEnd> info -> not_persistent |
1,192 | CWE-000 void * checkArrays ( void * arg ) { GridAndTmp * tmp = ( GridAndTmp * ) arg ; Grid * tmp_grid = tmp -> tmp_grid ; Grid * grid = tmp -> grid ; <S2SV_StartBug> RuleSet * rules = tmp -> rules ; <S2SV_EndBug> for ( unsigned int i = Grid_count ( grid , 1 ) ; i -- ; ) { Cell * c = CellArray_get ( grid -> lArray , i ) ; int nbrs = Grid_nbrs ( grid , c ) ; c -> nbrs_count = nbrs ; <S2SV_StartBug> if ( Cell_next ( c , rules ) == 1 ) { <S2SV_EndBug> Grid_set_checked ( tmp_grid , grid -> lArray -> c_array [ i ] -> row , grid -> lArray -> c_array [ i ] -> col , 1 ) ; Cell * c = Cell_new ( grid -> lArray -> c_array [ i ] -> row , grid -> lArray -> c_array [ i ] -> col ) ; c -> state = 1 ; CellArray_add ( tmp_grid -> lArray , c ) ; } CellArray_set ( grid -> lArray , CHECK , i , 1 ) ; Grid_Nbrs_check ( tmp_grid -> lArray , grid , grid -> lArray -> c_array [ i ] , rules ) ; } } | <S2SV_ModStart> tmp -> rules ; int count = Grid_count ( grid , 1 ) ; pthread_t thread1 [ count ] <S2SV_ModStart> = nbrs ; printf ( "Index:<S2SV_blank>%d::%d\\n" , i , grid -> lArray -> base . count ) ; |
1,193 | CWE-000 int main ( int argc , char * * argv ) { int i , j , initj ; FILE * infp ; char * * seq ; int * grpseq ; char * tmpseq ; int * * pointt ; static char * * name ; static int * nlen ; double * mtxself ; double score ; static short * table1 ; double longer , shorter ; double lenfac ; double bunbo ; int norg ; <S2SV_StartBug> arguments ( argc , argv ) ; <S2SV_EndBug> if ( inputfile ) { infp = fopen ( inputfile , "r" ) ; if ( ! infp ) { fprintf ( stderr , "Cannot<S2SV_blank>open<S2SV_blank>%s\\n" , inputfile ) ; exit ( 1 ) ; } } else infp = stdin ; # if 0 PreRead ( stdin , & njob , & nlenmax ) ; # else getnumlen ( infp ) ; # endif rewind ( infp ) ; if ( njob < 2 ) { fprintf ( stderr , "At<S2SV_blank>least<S2SV_blank>2<S2SV_blank>sequences<S2SV_blank>should<S2SV_blank>be<S2SV_blank>input!\\n" "Only<S2SV_blank>%d<S2SV_blank>sequence<S2SV_blank>found.\\n" , njob ) ; exit ( 1 ) ; } tmpseq = AllocateCharVec ( nlenmax + 1 ) ; seq = AllocateCharMtx ( njob , nlenmax + 1 ) ; grpseq = AllocateIntVec ( nlenmax + 1 ) ; pointt = AllocateIntMtx ( njob , nlenmax + 1 ) ; mtxself = AllocateDoubleVec ( njob ) ; pamN = NOTSPECIFIED ; name = AllocateCharMtx ( njob , B ) ; nlen = AllocateIntVec ( njob ) ; # if 0 FRead ( infp , name , nlen , seq ) ; # else readData_pointer ( infp , name , nlen , seq ) ; # endif fclose ( infp ) ; constants ( njob , seq ) ; if ( nadd ) outputformat = 's' ; norg = njob - nadd ; if ( dorp == 'd' ) tsize = ( int ) pow ( 4 , 6 ) ; else tsize = ( int ) pow ( 6 , 6 ) ; if ( dorp == 'd' ) { lenfaca = DLENFACA ; lenfacb = DLENFACB ; lenfacc = DLENFACC ; lenfacd = DLENFACD ; } else { lenfaca = PLENFACA ; lenfacb = PLENFACB ; lenfacc = PLENFACC ; lenfacd = PLENFACD ; } maxl = 0 ; for ( i = 0 ; i < njob ; i ++ ) { gappick0 ( tmpseq , seq [ i ] ) ; nlen [ i ] = strlen ( tmpseq ) ; if ( nlen [ i ] > maxl ) maxl = nlen [ i ] ; if ( dorp == 'd' ) { seq_grp_nuc ( grpseq , tmpseq ) ; makepointtable_nuc ( pointt [ i ] , grpseq ) ; } else { seq_grp ( grpseq , tmpseq ) ; makepointtable ( pointt [ i ] , grpseq ) ; } } fprintf ( stderr , "\\nCalculating<S2SV_blank>i-i<S2SV_blank>scores<S2SV_blank>...<S2SV_blank>" ) ; for ( i = 0 ; i < njob ; i ++ ) { table1 = ( short * ) calloc ( tsize , sizeof ( short ) ) ; if ( ! table1 ) ErrorExit ( "Cannot<S2SV_blank>allocate<S2SV_blank>table1\\n" ) ; makecompositiontable_p ( table1 , pointt [ i ] ) ; score = localcommonsextet_p ( table1 , pointt [ i ] ) ; mtxself [ i ] = score ; free ( table1 ) ; } fprintf ( stderr , "done.\\n" ) ; fprintf ( stderr , "\\nCalculating<S2SV_blank>i-j<S2SV_blank>scores<S2SV_blank>...<S2SV_blank>\\n" ) ; if ( outputformat == 'p' ) fprintf ( stdout , "%-5d" , njob ) ; for ( i = 0 ; i < norg ; i ++ ) { if ( outputformat == 'p' ) fprintf ( stdout , "\\n%-9d<S2SV_blank>" , i + 1 ) ; table1 = ( short * ) calloc ( tsize , sizeof ( short ) ) ; if ( ! table1 ) ErrorExit ( "Cannot<S2SV_blank>allocate<S2SV_blank>table1\\n" ) ; if ( i % 10 == 0 ) { fprintf ( stderr , "%4d<S2SV_blank>/<S2SV_blank>%4d\\r" , i + 1 , njob ) ; } makecompositiontable_p ( table1 , pointt [ i ] ) ; if ( nadd == 0 ) { if ( outputformat == 'p' ) initj = 0 ; else initj = i + 1 ; } else { initj = norg ; } for ( j = initj ; j < njob ; j ++ ) { if ( nlen [ i ] > nlen [ j ] ) { longer = ( double ) nlen [ i ] ; shorter = ( double ) nlen [ j ] ; } else { longer = ( double ) nlen [ j ] ; shorter = ( double ) nlen [ i ] ; } lenfac = 1.0 / ( shorter / longer * lenfacd + lenfacb / ( longer + lenfacc ) + lenfaca ) ; score = localcommonsextet_p ( table1 , pointt [ j ] ) ; bunbo = MIN ( mtxself [ i ] , mtxself [ j ] ) ; if ( outputformat == 'p' ) { if ( bunbo == 0.0 ) fprintf ( stdout , "<S2SV_blank>%8.6f" , 1.0 ) ; else fprintf ( stdout , "<S2SV_blank>%8.6f" , ( 1.0 - score / bunbo ) * lenfac ) ; if ( j % 7 == 6 ) fprintf ( stdout , "\\n" ) ; } else { if ( bunbo == 0.0 ) fprintf ( stdout , "%d-%d<S2SV_blank>d=%4.2f<S2SV_blank>l=%d,%d\\n" , i + 1 , j + 1 , 1.0 , nlen [ i ] , nlen [ j ] ) ; else fprintf ( stdout , "%d-%d<S2SV_blank>d=%4.2f<S2SV_blank>l=%d,%d\\n" , i + 1 , j + 1 , ( 1.0 - score / bunbo ) * lenfac , nlen [ i ] , nlen [ j ] ) ; } } free ( table1 ) ; } fprintf ( stderr , "\\n" ) ; if ( outputformat == 'p' ) fprintf ( stdout , "\\n" ) ; SHOWVERSION ; exit ( 0 ) ; } | <S2SV_ModStart> int norg ; mafft_distanceArguments <S2SV_ModEnd> ( argc , |
1,194 | CWE-000 bool runcamDeviceGetSettingDetail ( runcamDevice_t * device , uint8_t settingID , runcamDeviceSettingDetail_t * * outSettingDetail ) { uint8_t paramsBuf [ 2 ] ; uint8_t chunkIndex = 0 ; paramsBuf [ 0 ] = settingID ; paramsBuf [ 1 ] = chunkIndex ; uint8_t outputBufLen = RCDEVICE_PROTOCOL_MAX_DATA_SIZE ; uint8_t outputBuf [ RCDEVICE_PROTOCOL_MAX_DATA_SIZE ] ; bool result = runcamDeviceSendRequestAndWaitingResp ( device , RCDEVICE_PROTOCOL_COMMAND_READ_SETTING_DETAIL , paramsBuf , sizeof ( paramsBuf ) , outputBuf , & outputBufLen ) ; <S2SV_StartBug> if ( ! result ) <S2SV_EndBug> <S2SV_StartBug> return false ; <S2SV_EndBug> uint8_t remainingChunk = outputBuf [ 0 ] ; uint8_t maxDataLen = remainingChunk + 1 * RCDEVICE_PROTOCOL_MAX_DATA_SIZE ; uint8_t * data = ( uint8_t * ) malloc ( maxDataLen ) ; sbuf_t dataBuf ; dataBuf . ptr = data ; dataBuf . end = data + maxDataLen ; <S2SV_StartBug> sbufWriteData ( & dataBuf , outputBuf , outputBufLen ) ; <S2SV_EndBug> while ( remainingChunk > 0 ) { paramsBuf [ 1 ] = ++ chunkIndex ; result = runcamDeviceSendRequestAndWaitingResp ( device , RCDEVICE_PROTOCOL_COMMAND_READ_SETTING_DETAIL , paramsBuf , sizeof ( paramsBuf ) , outputBuf , & outputBufLen ) ; if ( ! result ) { SAFE_FREE ( data ) ; return false ; } <S2SV_StartBug> sbufWriteData ( & dataBuf , outputBuf , outputBufLen ) ; <S2SV_EndBug> remainingChunk -- ; } sbufSwitchToReader ( & dataBuf , data ) ; if ( ! runcamDeviceDecodeSettingDetail ( & dataBuf , outSettingDetail ) ) { SAFE_FREE ( data ) ; return false ; } SAFE_FREE ( data ) ; return true ; } | <S2SV_ModStart> ! result ) { <S2SV_ModStart> return false ; } <S2SV_ModStart> dataBuf , outputBuf + 1 , outputBufLen - 1 <S2SV_ModEnd> ) ; while <S2SV_ModStart> dataBuf , outputBuf + 1 , outputBufLen - 1 <S2SV_ModEnd> ) ; remainingChunk |
1,195 | CWE-000 int dm_lock_datastore ( dm_ctx_t * dm_ctx , dm_session_t * session ) { CHECK_NULL_ARG2 ( dm_ctx , session ) ; int rc = SR_ERR_OK ; sr_schema_t * schemas = NULL ; size_t schema_count = 0 ; sr_list_t * locked = NULL ; rc = sr_list_init ( & locked ) ; CHECK_RC_MSG_RETURN ( rc , "List<S2SV_blank>init<S2SV_blank>failed" ) ; rc = dm_list_schemas ( dm_ctx , session , & schemas , & schema_count ) ; CHECK_RC_MSG_GOTO ( rc , cleanup , "List<S2SV_blank>schemas<S2SV_blank>failed" ) ; if ( session -> datastore != SR_DS_CANDIDATE ) { pthread_mutex_lock ( & dm_ctx -> ds_lock_mutex ) ; if ( dm_ctx -> ds_lock [ session -> datastore ] ) { SR_LOG_ERR_MSG ( "Datastore<S2SV_blank>lock<S2SV_blank>is<S2SV_blank>held<S2SV_blank>by<S2SV_blank>another<S2SV_blank>session" ) ; rc = SR_ERR_LOCKED ; pthread_mutex_unlock ( & dm_ctx -> ds_lock_mutex ) ; goto cleanup ; } dm_ctx -> ds_lock [ session -> datastore ] = true ; pthread_mutex_unlock ( & dm_ctx -> ds_lock_mutex ) ; } session -> holds_ds_lock [ session -> datastore ] = true ; for ( size_t i = 0 ; i < schema_count ; i ++ ) { if ( ! schemas [ i ] . implemented ) { continue ; } rc = dm_lock_module ( dm_ctx , session , ( char * ) schemas [ i ] . module_name ) ; if ( SR_ERR_OK != rc ) { if ( SR_ERR_UNAUTHORIZED == rc ) { SR_LOG_INF ( "Not<S2SV_blank>allowed<S2SV_blank>to<S2SV_blank>lock<S2SV_blank>%s,<S2SV_blank>skipping" , schemas [ i ] . module_name ) ; continue ; } else if ( SR_ERR_LOCKED == rc ) { <S2SV_StartBug> SR_LOG_ERR ( "Model<S2SV_blank>%s<S2SV_blank>is<S2SV_blank>already<S2SV_blank>locked<S2SV_blank>by<S2SV_blank>anther<S2SV_blank>session" , schemas [ i ] . module_name ) ; <S2SV_EndBug> } for ( size_t l = 0 ; l < locked -> count ; l ++ ) { dm_unlock_module ( dm_ctx , session , ( char * ) locked -> data [ l ] ) ; } pthread_mutex_lock ( & dm_ctx -> ds_lock_mutex ) ; dm_ctx -> ds_lock [ session -> datastore ] = false ; pthread_mutex_unlock ( & dm_ctx -> ds_lock_mutex ) ; session -> holds_ds_lock [ session -> datastore ] = false ; goto cleanup ; } SR_LOG_DBG ( "Module<S2SV_blank>%s<S2SV_blank>locked" , schemas [ i ] . module_name ) ; rc = sr_list_add ( locked , ( char * ) schemas [ i ] . module_name ) ; CHECK_RC_MSG_GOTO ( rc , cleanup , "List<S2SV_blank>add<S2SV_blank>failed" ) ; } cleanup : sr_free_schemas ( schemas , schema_count ) ; sr_list_cleanup ( locked ) ; return rc ; } | <S2SV_ModStart> { SR_LOG_ERR ( "Model<S2SV_blank>%s<S2SV_blank>is<S2SV_blank>already<S2SV_blank>locked<S2SV_blank>by<S2SV_blank>another<S2SV_blank>session" <S2SV_ModEnd> , schemas [ |
1,196 | CWE-000 static int loadsanae ( char * filename ) { <S2SV_StartBug> png_structp pngp ; <S2SV_EndBug> png_infop infp ; unsigned int sread = 0 ; int col , inter ; FILE * pf ; if ( ! ( pf = fopen ( filename , "r" ) ) ) return 0 ; pngp = png_create_read_struct ( PNG_LIBPNG_VER_STRING , 0 , 0 , 0 ) ; if ( ! pngp ) { fclose ( pf ) ; return 0 ; } infp = png_create_info_struct ( pngp ) ; if ( ! infp ) { fclose ( pf ) ; png_destroy_read_struct ( & pngp , 0 , 0 ) ; return 0 ; } if ( setjmp ( png_jmpbuf ( pngp ) ) ) { png_destroy_read_struct ( & pngp , & infp , 0 ) ; fclose ( pf ) ; return 0 ; } png_init_io ( pngp , pf ) ; png_set_sig_bytes ( pngp , sread ) ; png_read_png ( pngp , infp , PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING | PNG_TRANSFORM_EXPAND , 0 ) ; png_uint_32 w , h ; int dep ; png_get_IHDR ( pngp , infp , & w , & h , & dep , & col , & inter , 0 , 0 ) ; sanniew = w ; sannieh = h ; sanniealpha = ( col == 6 ) ; int rbytes = png_get_rowbytes ( pngp , infp ) ; sannie = malloc ( rbytes * h ) ; png_bytepp rptr = png_get_rows ( pngp , infp ) ; for ( int i = 0 ; i < h ; i ++ ) memcpy ( sannie + ( rbytes * i ) , rptr [ i ] , rbytes ) ; png_destroy_read_struct ( & pngp , & infp , 0 ) ; fclose ( pf ) ; return 1 ; } | <S2SV_ModStart> filename ) { if ( ! filename ) return 0 ; |
1,197 | CWE-000 void evergreen_mc_resume ( struct radeon_device * rdev , struct evergreen_mc_save * save ) { u32 tmp , frame_count ; int i , j ; for ( i = 0 ; i < rdev -> num_crtc ; i ++ ) { WREG32 ( EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + crtc_offsets [ i ] , upper_32_bits ( rdev -> mc . vram_start ) ) ; WREG32 ( EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + crtc_offsets [ i ] , upper_32_bits ( rdev -> mc . vram_start ) ) ; WREG32 ( EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS + crtc_offsets [ i ] , ( u32 ) rdev -> mc . vram_start ) ; WREG32 ( EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets [ i ] , ( u32 ) rdev -> mc . vram_start ) ; } WREG32 ( EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH , upper_32_bits ( rdev -> mc . vram_start ) ) ; WREG32 ( EVERGREEN_VGA_MEMORY_BASE_ADDRESS , ( u32 ) rdev -> mc . vram_start ) ; for ( i = 0 ; i < rdev -> num_crtc ; i ++ ) { if ( save -> crtc_enabled [ i ] ) { tmp = RREG32 ( EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets [ i ] ) ; if ( ( tmp & 0x3 ) != 0 ) { tmp &= ~ 0x3 ; WREG32 ( EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets [ i ] , tmp ) ; } tmp = RREG32 ( EVERGREEN_GRPH_UPDATE + crtc_offsets [ i ] ) ; if ( tmp & EVERGREEN_GRPH_UPDATE_LOCK ) { tmp &= ~ EVERGREEN_GRPH_UPDATE_LOCK ; WREG32 ( EVERGREEN_GRPH_UPDATE + crtc_offsets [ i ] , tmp ) ; } tmp = RREG32 ( EVERGREEN_MASTER_UPDATE_LOCK + crtc_offsets [ i ] ) ; if ( tmp & 1 ) { tmp &= ~ 1 ; WREG32 ( EVERGREEN_MASTER_UPDATE_LOCK + crtc_offsets [ i ] , tmp ) ; } for ( j = 0 ; j < rdev -> usec_timeout ; j ++ ) { tmp = RREG32 ( EVERGREEN_GRPH_UPDATE + crtc_offsets [ i ] ) ; if ( ( tmp & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING ) == 0 ) break ; udelay ( 1 ) ; } } } tmp = RREG32 ( MC_SHARED_BLACKOUT_CNTL ) ; tmp &= ~ BLACKOUT_MODE_MASK ; WREG32 ( MC_SHARED_BLACKOUT_CNTL , tmp ) ; WREG32 ( BIF_FB_EN , FB_READ_EN | FB_WRITE_EN ) ; for ( i = 0 ; i < rdev -> num_crtc ; i ++ ) { <S2SV_StartBug> if ( save -> crtc_enabled ) { <S2SV_EndBug> if ( ASIC_IS_DCE6 ( rdev ) ) { tmp = RREG32 ( EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets [ i ] ) ; tmp |= EVERGREEN_CRTC_BLANK_DATA_EN ; WREG32 ( EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets [ i ] , 1 ) ; WREG32 ( EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets [ i ] , tmp ) ; WREG32 ( EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets [ i ] , 0 ) ; } else { tmp = RREG32 ( EVERGREEN_CRTC_CONTROL + crtc_offsets [ i ] ) ; tmp &= ~ EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE ; WREG32 ( EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets [ i ] , 1 ) ; WREG32 ( EVERGREEN_CRTC_CONTROL + crtc_offsets [ i ] , tmp ) ; WREG32 ( EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets [ i ] , 0 ) ; } frame_count = radeon_get_vblank_counter ( rdev , i ) ; for ( j = 0 ; j < rdev -> usec_timeout ; j ++ ) { if ( radeon_get_vblank_counter ( rdev , i ) != frame_count ) break ; udelay ( 1 ) ; } } } WREG32 ( VGA_HDP_CONTROL , save -> vga_hdp_control ) ; mdelay ( 1 ) ; WREG32 ( VGA_RENDER_CONTROL , save -> vga_render_control ) ; } | <S2SV_ModStart> save -> crtc_enabled [ i ] |
1,198 | CWE-000 Imaging ImagingColorLUT3D_linear ( Imaging imOut , Imaging imIn , int table_channels , int size1D , int size2D , int size3D , INT16 * table ) { UINT32 scale1D = ( size1D - 1 ) / 255.0 * ( 1 << SCALE_BITS ) ; UINT32 scale2D = ( size2D - 1 ) / 255.0 * ( 1 << SCALE_BITS ) ; UINT32 scale3D = ( size3D - 1 ) / 255.0 * ( 1 << SCALE_BITS ) ; int size1D_2D = size1D * size2D ; int x , y ; if ( table_channels < 3 || table_channels > 4 ) { PyErr_SetString ( PyExc_ValueError , "table_channels<S2SV_blank>could<S2SV_blank>be<S2SV_blank>3<S2SV_blank>or<S2SV_blank>4" ) ; return NULL ; } if ( imIn -> type != IMAGING_TYPE_UINT8 || imOut -> type != IMAGING_TYPE_UINT8 || imIn -> bands < 3 || imOut -> bands < table_channels ) { return ( Imaging ) ImagingError_ModeError ( ) ; } if ( imOut -> bands > table_channels && imOut -> bands > imIn -> bands ) { return ( Imaging ) ImagingError_ModeError ( ) ; } for ( y = 0 ; y < imOut -> ysize ; y ++ ) { UINT8 * rowIn = ( UINT8 * ) imIn -> image [ y ] ; UINT32 * rowOut = ( UINT32 * ) imOut -> image [ y ] ; for ( x = 0 ; x < imOut -> xsize ; x ++ ) { UINT32 index1D = rowIn [ x * 4 + 0 ] * scale1D ; UINT32 index2D = rowIn [ x * 4 + 1 ] * scale2D ; UINT32 index3D = rowIn [ x * 4 + 2 ] * scale3D ; INT16 shift1D = ( SCALE_MASK & index1D ) >> ( SCALE_BITS - SHIFT_BITS ) ; INT16 shift2D = ( SCALE_MASK & index2D ) >> ( SCALE_BITS - SHIFT_BITS ) ; INT16 shift3D = ( SCALE_MASK & index3D ) >> ( SCALE_BITS - SHIFT_BITS ) ; <S2SV_StartBug> int idx = 3 * table_index3D ( <S2SV_EndBug> index1D >> SCALE_BITS , index2D >> SCALE_BITS , index3D >> SCALE_BITS , size1D , size1D_2D ) ; INT16 result [ 4 ] , left [ 4 ] , right [ 4 ] ; INT16 leftleft [ 4 ] , leftright [ 4 ] , rightleft [ 4 ] , rightright [ 4 ] ; if ( table_channels == 3 ) { interpolate3 ( leftleft , & table [ idx + 0 ] , & table [ idx + 3 ] , shift1D ) ; interpolate3 ( leftright , & table [ idx + size1D * 3 ] , & table [ idx + size1D * 3 + 3 ] , shift1D ) ; interpolate3 ( left , leftleft , leftright , shift2D ) ; interpolate3 ( rightleft , & table [ idx + size1D_2D * 3 ] , & table [ idx + size1D_2D * 3 + 3 ] , shift1D ) ; interpolate3 ( rightright , & table [ idx + size1D_2D * 3 + size1D * 3 ] , & table [ idx + size1D_2D * 3 + size1D * 3 + 3 ] , shift1D ) ; interpolate3 ( right , rightleft , rightright , shift2D ) ; interpolate3 ( result , left , right , shift3D ) ; rowOut [ x ] = MAKE_UINT32 ( clip8 ( result [ 0 ] ) , clip8 ( result [ 1 ] ) , clip8 ( result [ 2 ] ) , rowIn [ x * 4 + 3 ] ) ; } if ( table_channels == 4 ) { interpolate4 ( leftleft , & table [ idx + 0 ] , & table [ idx + 4 ] , shift1D ) ; interpolate4 ( leftright , & table [ idx + size1D * 4 ] , & table [ idx + size1D * 4 + 4 ] , shift1D ) ; interpolate4 ( left , leftleft , leftright , shift2D ) ; interpolate4 ( rightleft , & table [ idx + size1D_2D * 4 ] , & table [ idx + size1D_2D * 4 + 4 ] , shift1D ) ; interpolate4 ( rightright , & table [ idx + size1D_2D * 4 + size1D * 4 ] , & table [ idx + size1D_2D * 4 + size1D * 4 + 4 ] , shift1D ) ; interpolate4 ( right , rightleft , rightright , shift2D ) ; interpolate4 ( result , left , right , shift3D ) ; rowOut [ x ] = MAKE_UINT32 ( clip8 ( result [ 0 ] ) , clip8 ( result [ 1 ] ) , clip8 ( result [ 2 ] ) , clip8 ( result [ 3 ] ) ) ; } } } return imOut ; } | <S2SV_ModStart> int idx = table_channels <S2SV_ModEnd> * table_index3D ( |
1,199 | CWE-000 static void _cp_64ctxt_to_64gdb ( struct cpu_user_regs_x86_64 * cp , struct xg_gdb_regs64 * rp ) { memset ( rp , 0 , sizeof ( struct xg_gdb_regs64 ) ) ; rp -> r8 = cp -> r8 ; rp -> r9 = cp -> r9 ; rp -> r10 = cp -> r10 ; rp -> r11 = cp -> r11 ; rp -> r12 = cp -> r12 ; rp -> r13 = cp -> r13 ; rp -> r14 = cp -> r14 ; rp -> r15 = cp -> r15 ; rp -> rbx = cp -> rbx ; rp -> rcx = cp -> rcx ; rp -> rdx = cp -> rdx ; rp -> rsi = cp -> rsi ; rp -> rdi = cp -> rdi ; rp -> rbp = cp -> rbp ; rp -> rax = cp -> rax ; rp -> rip = cp -> rip ; rp -> rsp = cp -> rsp ; <S2SV_StartBug> rp -> rflags = cp -> rflags ; <S2SV_EndBug> <S2SV_StartBug> rp -> cs = ( uint64_t ) cp -> cs ; <S2SV_EndBug> <S2SV_StartBug> rp -> ss = ( uint64_t ) cp -> ss ; <S2SV_EndBug> <S2SV_StartBug> rp -> es = ( uint64_t ) cp -> es ; <S2SV_EndBug> <S2SV_StartBug> rp -> ds = ( uint64_t ) cp -> ds ; <S2SV_EndBug> <S2SV_StartBug> rp -> fs = ( uint64_t ) cp -> fs ; <S2SV_EndBug> <S2SV_StartBug> rp -> gs = ( uint64_t ) cp -> gs ; <S2SV_EndBug> # if 0 printf ( "cp:%llx<S2SV_blank>bp:%llx<S2SV_blank>rip:%llx\\n" , rp -> rsp , rp -> rbp , rp -> rip ) ; printf ( "rax:%llx<S2SV_blank>rbx:%llx\\n" , rp -> rax , rp -> rbx ) ; printf ( "cs:%04x<S2SV_blank>ss:%04x<S2SV_blank>ds:%04x\\n" , ( int ) rp -> cs , ( int ) rp -> ss , ( int ) rp -> ds ) ; # endif } | <S2SV_ModStart> ; rp -> eflags = cp -> rflags <S2SV_ModEnd> ; rp -> <S2SV_ModStart> -> cs = <S2SV_ModEnd> cp -> cs <S2SV_ModStart> -> ss = <S2SV_ModEnd> cp -> ss <S2SV_ModStart> -> es = <S2SV_ModEnd> cp -> es <S2SV_ModStart> -> ds = <S2SV_ModEnd> cp -> ds <S2SV_ModStart> -> fs = <S2SV_ModEnd> cp -> fs <S2SV_ModStart> -> gs = <S2SV_ModEnd> cp -> gs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.