unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
93,536
0
static int ip6mr_mfc_delete(struct mr6_table *mrt, struct mf6cctl *mfc, int parent) { int line; struct mfc6_cache *c, *next; line = MFC6_HASH(&mfc->mf6cc_mcastgrp.sin6_addr, &mfc->mf6cc_origin.sin6_addr); list_for_each_entry_safe(c, next, &mrt->mfc6_cache_array[line], list) { if (ipv6_addr_equal(&c->mf6c_origin, &mfc->mf6cc_origin.sin6_addr) && ipv6_addr_equal(&c->mf6c_mcastgrp, &mfc->mf6cc_mcastgrp.sin6_addr) && (parent == -1 || parent == c->mf6c_parent)) { write_lock_bh(&mrt_lock); list_del(&c->list); write_unlock_bh(&mrt_lock); mr6_netlink_event(mrt, c, RTM_DELROUTE); ip6mr_cache_free(c); return 0; } } return -ENOENT; }
5,100
173,229
0
store_freenew(png_store *ps) { store_freebuffer(&ps->new); ps->writepos = 0; if (ps->palette != NULL) { free(ps->palette); ps->palette = NULL; ps->npalette = 0; } }
5,101
114,964
0
void TestingAutomationProvider::GoBack( DictionaryValue* args, IPC::Message* reply_message) { if (SendErrorIfModalDialogActive(this, reply_message)) return; WebContents* web_contents; std::string error; if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } NavigationController& controller = web_contents->GetController(); if (!controller.CanGoBack()) { DictionaryValue dict; dict.SetBoolean("did_go_back", false); AutomationJSONReply(this, reply_message).SendSuccess(&dict); return; } new NavigationNotificationObserver(&controller, this, reply_message, 1, false, true); controller.GoBack(); }
5,102
138,956
0
void WallpaperManagerBase::EnsureLoggedInUserWallpaperLoaded() { WallpaperInfo info; if (GetLoggedInUserWallpaperInfo(&info)) { UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Type", info.type, WALLPAPER_TYPE_COUNT); RecordWallpaperAppType(); if (info == current_user_wallpaper_info_) return; } SetUserWallpaperNow( user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()); }
5,103
162,252
0
void CommandBufferProxyImpl::DestroyImage(int32_t id) { CheckLock(); base::AutoLock lock(last_state_lock_); if (last_state_.error != gpu::error::kNoError) return; Send(new GpuCommandBufferMsg_DestroyImage(route_id_, id)); }
5,104
21,248
0
int make_pages_present(unsigned long addr, unsigned long end) { int ret, len, write; struct vm_area_struct * vma; vma = find_vma(current->mm, addr); if (!vma) return -ENOMEM; /* * We want to touch writable mappings with a write fault in order * to break COW, except for shared mappings because these don't COW * and we would not want to dirty them for nothing. */ write = (vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE; BUG_ON(addr >= end); BUG_ON(end > vma->vm_end); len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE; ret = get_user_pages(current, current->mm, addr, len, write, 0, NULL, NULL); if (ret < 0) return ret; return ret == len ? 0 : -EFAULT; }
5,105
110,239
0
NaClIPCAdapter::IOThreadData::IOThreadData() { }
5,106
134,178
0
bool InputMethodWin::IsActive() { return active_; }
5,107
117,762
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNamedConstructorTemplate(v8::Persistent<v8::FunctionTemplate> desc) { desc->ReadOnlyPrototype(); v8::Local<v8::Signature> defaultSignature; defaultSignature = configureTemplate(desc, "TestNamedConstructor", v8::Persistent<v8::FunctionTemplate>(), V8TestNamedConstructor::internalFieldCount, 0, 0, 0, 0); UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. desc->Set(getToStringName(), getToStringTemplate()); return desc; }
5,108
56,304
0
static double KernelBessel_Order1(double x) { double p, q; if (x == 0.0) return (0.0f); p = x; if (x < 0.0) x=(-x); if (x < 8.0) return (p*KernelBessel_J1(x)); q = (double)sqrt(2.0f/(M_PI*x))*(double)(KernelBessel_P1(x)*(1.0f/sqrt(2.0f)*(sin(x)-cos(x)))-8.0f/x*KernelBessel_Q1(x)* (-1.0f/sqrt(2.0f)*(sin(x)+cos(x)))); if (p < 0.0f) q = (-q); return (q); }
5,109
43,666
0
static int lookup_slow(struct nameidata *nd, struct path *path) { struct dentry *dentry, *parent; parent = nd->path.dentry; BUG_ON(nd->inode != parent->d_inode); mutex_lock(&parent->d_inode->i_mutex); dentry = __lookup_hash(&nd->last, parent, nd->flags); mutex_unlock(&parent->d_inode->i_mutex); if (IS_ERR(dentry)) return PTR_ERR(dentry); path->mnt = nd->path.mnt; path->dentry = dentry; return follow_managed(path, nd); }
5,110
14,249
0
static void php_libxml_ctx_error_level(int level, void *ctx, const char *msg TSRMLS_DC) { xmlParserCtxtPtr parser; parser = (xmlParserCtxtPtr) ctx; if (parser != NULL && parser->input != NULL) { if (parser->input->filename) { php_error_docref(NULL TSRMLS_CC, level, "%s in %s, line: %d", msg, parser->input->filename, parser->input->line); } else { php_error_docref(NULL TSRMLS_CC, level, "%s in Entity, line: %d", msg, parser->input->line); } } }
5,111
171,507
0
bool SoftVPX::outputBuffers(bool flushDecoder, bool display, bool eos, bool *portWillReset) { List<BufferInfo *> &outQueue = getPortQueue(1); BufferInfo *outInfo = NULL; OMX_BUFFERHEADERTYPE *outHeader = NULL; vpx_codec_iter_t iter = NULL; if (flushDecoder && mFrameParallelMode) { if (vpx_codec_decode((vpx_codec_ctx_t *)mCtx, NULL, 0, NULL, 0)) { ALOGE("Failed to flush on2 decoder."); return false; } } if (!display) { if (!flushDecoder) { ALOGE("Invalid operation."); return false; } while ((mImg = vpx_codec_get_frame((vpx_codec_ctx_t *)mCtx, &iter))) { } return true; } while (!outQueue.empty()) { if (mImg == NULL) { mImg = vpx_codec_get_frame((vpx_codec_ctx_t *)mCtx, &iter); if (mImg == NULL) { break; } } uint32_t width = mImg->d_w; uint32_t height = mImg->d_h; outInfo = *outQueue.begin(); outHeader = outInfo->mHeader; CHECK_EQ(mImg->fmt, VPX_IMG_FMT_I420); handlePortSettingsChange(portWillReset, width, height); if (*portWillReset) { return true; } outHeader->nOffset = 0; outHeader->nFlags = 0; outHeader->nFilledLen = (outputBufferWidth() * outputBufferHeight() * 3) / 2; outHeader->nTimeStamp = *(OMX_TICKS *)mImg->user_priv; if (outputBufferSafe(outHeader)) { uint8_t *dst = outHeader->pBuffer; const uint8_t *srcY = (const uint8_t *)mImg->planes[VPX_PLANE_Y]; const uint8_t *srcU = (const uint8_t *)mImg->planes[VPX_PLANE_U]; const uint8_t *srcV = (const uint8_t *)mImg->planes[VPX_PLANE_V]; size_t srcYStride = mImg->stride[VPX_PLANE_Y]; size_t srcUStride = mImg->stride[VPX_PLANE_U]; size_t srcVStride = mImg->stride[VPX_PLANE_V]; copyYV12FrameToOutputBuffer(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride); } else { outHeader->nFilledLen = 0; } mImg = NULL; outInfo->mOwnedByUs = false; outQueue.erase(outQueue.begin()); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; } if (!eos) { return true; } if (!outQueue.empty()) { outInfo = *outQueue.begin(); outQueue.erase(outQueue.begin()); outHeader = outInfo->mHeader; outHeader->nTimeStamp = 0; outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; outInfo->mOwnedByUs = false; notifyFillBufferDone(outHeader); mEOSStatus = OUTPUT_FRAMES_FLUSHED; } return true; }
5,112
99,177
0
v8::Handle<v8::Value> V8DOMWrapper::convertDOMImplementationToV8Object(DOMImplementation* impl) { v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::DOMIMPLEMENTATION, V8ClassIndex::DOMIMPLEMENTATION, impl); if (result.IsEmpty()) { return v8::Null(); } return result; }
5,113
57,449
0
ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path, ext4_lblk_t *logical, ext4_fsblk_t *phys) { struct buffer_head *bh = NULL; struct ext4_extent_header *eh; struct ext4_extent_idx *ix; struct ext4_extent *ex; ext4_fsblk_t block; int depth; /* Note, NOT eh_depth; depth from top of tree */ int ee_len; BUG_ON(path == NULL); depth = path->p_depth; *phys = 0; if (depth == 0 && path->p_ext == NULL) return 0; /* usually extent in the path covers blocks smaller * then *logical, but it can be that extent is the * first one in the file */ ex = path[depth].p_ext; ee_len = ext4_ext_get_actual_len(ex); if (*logical < le32_to_cpu(ex->ee_block)) { BUG_ON(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex); while (--depth >= 0) { ix = path[depth].p_idx; BUG_ON(ix != EXT_FIRST_INDEX(path[depth].p_hdr)); } *logical = le32_to_cpu(ex->ee_block); *phys = ext_pblock(ex); return 0; } BUG_ON(*logical < (le32_to_cpu(ex->ee_block) + ee_len)); if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) { /* next allocated block in this leaf */ ex++; *logical = le32_to_cpu(ex->ee_block); *phys = ext_pblock(ex); return 0; } /* go up and search for index to the right */ while (--depth >= 0) { ix = path[depth].p_idx; if (ix != EXT_LAST_INDEX(path[depth].p_hdr)) goto got_index; } /* we've gone up to the root and found no index to the right */ return 0; got_index: /* we've found index to the right, let's * follow it and find the closest allocated * block to the right */ ix++; block = idx_pblock(ix); while (++depth < path->p_depth) { bh = sb_bread(inode->i_sb, block); if (bh == NULL) return -EIO; eh = ext_block_hdr(bh); /* subtract from p_depth to get proper eh_depth */ if (ext4_ext_check(inode, eh, path->p_depth - depth)) { put_bh(bh); return -EIO; } ix = EXT_FIRST_INDEX(eh); block = idx_pblock(ix); put_bh(bh); } bh = sb_bread(inode->i_sb, block); if (bh == NULL) return -EIO; eh = ext_block_hdr(bh); if (ext4_ext_check(inode, eh, path->p_depth - depth)) { put_bh(bh); return -EIO; } ex = EXT_FIRST_EXTENT(eh); *logical = le32_to_cpu(ex->ee_block); *phys = ext_pblock(ex); put_bh(bh); return 0; }
5,114
113,794
0
bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( WebKit::WebFrame* frame, const WebKit::WebNode& node, scoped_ptr<PrepareFrameAndViewForPrint>* prepare) { DCHECK(frame); if (!InitPrintSettings()) { notify_browser_of_print_failure_ = false; render_view()->RunModalAlertDialog( frame, l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS)); return false; } DCHECK(!prepare->get()); prepare->reset(new PrepareFrameAndViewForPrint(print_pages_params_->params, frame, node)); UpdateFrameAndViewFromCssPageLayout(frame, node, prepare->get(), print_pages_params_->params, ignore_css_margins_); Send(new PrintHostMsg_DidGetDocumentCookie( routing_id(), print_pages_params_->params.document_cookie)); return true; }
5,115
90,400
0
blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) { struct megasas_instance *instance; unsigned long flags; if (time_after(jiffies, scmd->jiffies_at_alloc + (scmd_timeout * 2) * HZ)) { return BLK_EH_DONE; } instance = (struct megasas_instance *)scmd->device->host->hostdata; if (!(instance->flag & MEGASAS_FW_BUSY)) { /* FW is busy, throttle IO */ spin_lock_irqsave(instance->host->host_lock, flags); instance->host->can_queue = instance->throttlequeuedepth; instance->last_time = jiffies; instance->flag |= MEGASAS_FW_BUSY; spin_unlock_irqrestore(instance->host->host_lock, flags); } return BLK_EH_RESET_TIMER; }
5,116
133,200
0
void SchedulerHelper::PumpQueue(size_t queue_index) { CheckOnValidThread(); return task_queue_manager_->PumpQueue(queue_index); }
5,117
48,995
0
void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, struct brcmf_cfg80211_vif *vif) { struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; spin_lock(&event->vif_event_lock); event->vif = vif; event->action = 0; spin_unlock(&event->vif_event_lock); }
5,118
97,572
0
xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) { if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->numberObjs != NULL) && (cache->numberObjs->number != 0)) { xmlXPathObjectPtr ret; ret = (xmlXPathObjectPtr) cache->numberObjs->items[--cache->numberObjs->number]; ret->type = XPATH_NUMBER; ret->floatval = val; #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_NUMBER); #endif return(ret); } else if ((cache->miscObjs != NULL) && (cache->miscObjs->number != 0)) { xmlXPathObjectPtr ret; ret = (xmlXPathObjectPtr) cache->miscObjs->items[--cache->miscObjs->number]; ret->type = XPATH_NUMBER; ret->floatval = val; #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_NUMBER); #endif return(ret); } } return(xmlXPathNewFloat(val)); }
5,119
57,209
0
static int nfs4_proc_remove(struct inode *dir, struct qstr *name) { struct nfs4_exception exception = { }; int err; do { err = _nfs4_proc_remove(dir, name); trace_nfs4_remove(dir, name, err); err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); } while (exception.retry); return err; }
5,120
34,372
0
static noinline int compress_file_range(struct inode *inode, struct page *locked_page, u64 start, u64 end, struct async_cow *async_cow, int *num_added) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans; u64 num_bytes; u64 blocksize = root->sectorsize; u64 actual_end; u64 isize = i_size_read(inode); int ret = 0; struct page **pages = NULL; unsigned long nr_pages; unsigned long nr_pages_ret = 0; unsigned long total_compressed = 0; unsigned long total_in = 0; unsigned long max_compressed = 128 * 1024; unsigned long max_uncompressed = 128 * 1024; int i; int will_compress; int compress_type = root->fs_info->compress_type; /* if this is a small write inside eof, kick off a defrag */ if ((end - start + 1) < 16 * 1024 && (start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size)) btrfs_add_inode_defrag(NULL, inode); actual_end = min_t(u64, isize, end + 1); again: will_compress = 0; nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); /* * we don't want to send crud past the end of i_size through * compression, that's just a waste of CPU time. So, if the * end of the file is before the start of our current * requested range of bytes, we bail out to the uncompressed * cleanup code that can deal with all of this. * * It isn't really the fastest way to fix things, but this is a * very uncommon corner. */ if (actual_end <= start) goto cleanup_and_bail_uncompressed; total_compressed = actual_end - start; /* we want to make sure that amount of ram required to uncompress * an extent is reasonable, so we limit the total size in ram * of a compressed extent to 128k. This is a crucial number * because it also controls how easily we can spread reads across * cpus for decompression. * * We also want to make sure the amount of IO required to do * a random read is reasonably small, so we limit the size of * a compressed extent to 128k. */ total_compressed = min(total_compressed, max_uncompressed); num_bytes = (end - start + blocksize) & ~(blocksize - 1); num_bytes = max(blocksize, num_bytes); total_in = 0; ret = 0; /* * we do compression for mount -o compress and when the * inode has not been flagged as nocompress. This flag can * change at any time if we discover bad compression ratios. */ if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS) && (btrfs_test_opt(root, COMPRESS) || (BTRFS_I(inode)->force_compress) || (BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) { WARN_ON(pages); pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); if (!pages) { /* just bail out to the uncompressed code */ goto cont; } if (BTRFS_I(inode)->force_compress) compress_type = BTRFS_I(inode)->force_compress; ret = btrfs_compress_pages(compress_type, inode->i_mapping, start, total_compressed, pages, nr_pages, &nr_pages_ret, &total_in, &total_compressed, max_compressed); if (!ret) { unsigned long offset = total_compressed & (PAGE_CACHE_SIZE - 1); struct page *page = pages[nr_pages_ret - 1]; char *kaddr; /* zero the tail end of the last page, we might be * sending it down to disk */ if (offset) { kaddr = kmap_atomic(page); memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset); kunmap_atomic(kaddr); } will_compress = 1; } } cont: if (start == 0) { trans = btrfs_join_transaction(root); if (IS_ERR(trans)) { ret = PTR_ERR(trans); trans = NULL; goto cleanup_and_out; } trans->block_rsv = &root->fs_info->delalloc_block_rsv; /* lets try to make an inline extent */ if (ret || total_in < (actual_end - start)) { /* we didn't compress the entire range, try * to make an uncompressed inline extent. */ ret = cow_file_range_inline(trans, root, inode, start, end, 0, 0, NULL); } else { /* try making a compressed inline extent */ ret = cow_file_range_inline(trans, root, inode, start, end, total_compressed, compress_type, pages); } if (ret <= 0) { /* * inline extent creation worked or returned error, * we don't need to create any more async work items. * Unlock and free up our temp pages. */ extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree, start, end, NULL, EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | EXTENT_CLEAR_DELALLOC | EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK); btrfs_end_transaction(trans, root); goto free_pages_out; } btrfs_end_transaction(trans, root); } if (will_compress) { /* * we aren't doing an inline extent round the compressed size * up to a block size boundary so the allocator does sane * things */ total_compressed = (total_compressed + blocksize - 1) & ~(blocksize - 1); /* * one last check to make sure the compression is really a * win, compare the page count read with the blocks on disk */ total_in = (total_in + PAGE_CACHE_SIZE - 1) & ~(PAGE_CACHE_SIZE - 1); if (total_compressed >= total_in) { will_compress = 0; } else { num_bytes = total_in; } } if (!will_compress && pages) { /* * the compression code ran but failed to make things smaller, * free any pages it allocated and our page pointer array */ for (i = 0; i < nr_pages_ret; i++) { WARN_ON(pages[i]->mapping); page_cache_release(pages[i]); } kfree(pages); pages = NULL; total_compressed = 0; nr_pages_ret = 0; /* flag the file so we don't compress in the future */ if (!btrfs_test_opt(root, FORCE_COMPRESS) && !(BTRFS_I(inode)->force_compress)) { BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; } } if (will_compress) { *num_added += 1; /* the async work queues will take care of doing actual * allocation on disk for these compressed pages, * and will submit them to the elevator. */ add_async_extent(async_cow, start, num_bytes, total_compressed, pages, nr_pages_ret, compress_type); if (start + num_bytes < end) { start += num_bytes; pages = NULL; cond_resched(); goto again; } } else { cleanup_and_bail_uncompressed: /* * No compression, but we still need to write the pages in * the file we've been given so far. redirty the locked * page if it corresponds to our extent and set things up * for the async work queue to run cow_file_range to do * the normal delalloc dance */ if (page_offset(locked_page) >= start && page_offset(locked_page) <= end) { __set_page_dirty_nobuffers(locked_page); /* unlocked later on in the async handlers */ } add_async_extent(async_cow, start, end - start + 1, 0, NULL, 0, BTRFS_COMPRESS_NONE); *num_added += 1; } out: return ret; free_pages_out: for (i = 0; i < nr_pages_ret; i++) { WARN_ON(pages[i]->mapping); page_cache_release(pages[i]); } kfree(pages); goto out; cleanup_and_out: extent_clear_unlock_delalloc(inode, &BTRFS_I(inode)->io_tree, start, end, NULL, EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | EXTENT_CLEAR_DELALLOC | EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK); if (!trans || IS_ERR(trans)) btrfs_error(root->fs_info, ret, "Failed to join transaction"); else btrfs_abort_transaction(trans, root, ret); goto free_pages_out; }
5,121
187,947
1
IMPEG2D_ERROR_CODES_T impeg2d_vld_decode( dec_state_t *ps_dec, WORD16 *pi2_outAddr, /*!< Address where decoded symbols will be stored */ const UWORD8 *pu1_scan, /*!< Scan table to be used */ UWORD8 *pu1_pos, /*!< Scan table to be used */ UWORD16 u2_intra_flag, /*!< Intra Macroblock or not */ UWORD16 u2_chroma_flag, /*!< Chroma Block or not */ UWORD16 u2_d_picture, /*!< D Picture or not */ UWORD16 u2_intra_vlc_format, /*!< Intra VLC format */ UWORD16 u2_mpeg2, /*!< MPEG-2 or not */ WORD32 *pi4_num_coeffs /*!< Returns the number of coeffs in block */ ) { UWORD32 u4_sym_len; UWORD32 u4_decoded_value; UWORD32 u4_level_first_byte; WORD32 u4_level; UWORD32 u4_run, u4_numCoeffs; UWORD32 u4_buf; UWORD32 u4_buf_nxt; UWORD32 u4_offset; UWORD32 *pu4_buf_aligned; UWORD32 u4_bits; stream_t *ps_stream = &ps_dec->s_bit_stream; WORD32 u4_pos; UWORD32 u4_nz_cols; UWORD32 u4_nz_rows; *pi4_num_coeffs = 0; ps_dec->u4_non_zero_cols = 0; ps_dec->u4_non_zero_rows = 0; u4_nz_cols = ps_dec->u4_non_zero_cols; u4_nz_rows = ps_dec->u4_non_zero_rows; GET_TEMP_STREAM_DATA(u4_buf,u4_buf_nxt,u4_offset,pu4_buf_aligned,ps_stream) /**************************************************************************/ /* Decode the DC coefficient in case of Intra block */ /**************************************************************************/ if(u2_intra_flag) { WORD32 dc_size; WORD32 dc_diff; WORD32 maxLen; WORD32 idx; maxLen = MPEG2_DCT_DC_SIZE_LEN; idx = 0; if(u2_chroma_flag != 0) { maxLen += 1; idx++; } { WORD16 end = 0; UWORD32 maxLen_tmp = maxLen; UWORD16 m_iBit; /* Get the maximum number of bits needed to decode a symbol */ IBITS_NXT(u4_buf,u4_buf_nxt,u4_offset,u4_bits,maxLen) do { maxLen_tmp--; /* Read one bit at a time from the variable to decode the huffman code */ m_iBit = (UWORD8)((u4_bits >> maxLen_tmp) & 0x1); /* Get the next node pointer or the symbol from the tree */ end = gai2_impeg2d_dct_dc_size[idx][end][m_iBit]; }while(end > 0); dc_size = end + MPEG2_DCT_DC_SIZE_OFFSET; /* Flush the appropriate number of bits from the stream */ FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,(maxLen - maxLen_tmp),pu4_buf_aligned) } if (dc_size != 0) { UWORD32 u4_bits; IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned, dc_size) dc_diff = u4_bits; if ((dc_diff & (1 << (dc_size - 1))) == 0) //v Probably the prediction algo? dc_diff -= (1 << dc_size) - 1; } else { dc_diff = 0; } pi2_outAddr[*pi4_num_coeffs] = dc_diff; /* This indicates the position of the coefficient. Since this is the DC * coefficient, we put the position as 0. */ pu1_pos[*pi4_num_coeffs] = pu1_scan[0]; (*pi4_num_coeffs)++; if (0 != dc_diff) { u4_nz_cols |= 0x01; u4_nz_rows |= 0x01; } u4_numCoeffs = 1; } /**************************************************************************/ /* Decoding of first AC coefficient in case of non Intra block */ /**************************************************************************/ else { /* First symbol can be 1s */ UWORD32 u4_bits; IBITS_NXT(u4_buf,u4_buf_nxt,u4_offset,u4_bits,1) if(u4_bits == 1) { FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,1, pu4_buf_aligned) IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned, 1) if(u4_bits == 1) { pi2_outAddr[*pi4_num_coeffs] = -1; } else { pi2_outAddr[*pi4_num_coeffs] = 1; } /* This indicates the position of the coefficient. Since this is the DC * coefficient, we put the position as 0. */ pu1_pos[*pi4_num_coeffs] = pu1_scan[0]; (*pi4_num_coeffs)++; u4_numCoeffs = 1; u4_nz_cols |= 0x01; u4_nz_rows |= 0x01; } else { u4_numCoeffs = 0; } } if (1 == u2_d_picture) { PUT_TEMP_STREAM_DATA(u4_buf, u4_buf_nxt, u4_offset, pu4_buf_aligned, ps_stream) ps_dec->u4_non_zero_cols = u4_nz_cols; ps_dec->u4_non_zero_rows = u4_nz_rows; return ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE); } if (1 == u2_intra_vlc_format && u2_intra_flag) { while(1) { //Putting the impeg2d_dec_ac_coeff_one function inline. UWORD32 lead_zeros; WORD16 DecodedValue; u4_sym_len = 17; IBITS_NXT(u4_buf,u4_buf_nxt,u4_offset,u4_bits,u4_sym_len) DecodedValue = gau2_impeg2d_tab_one_1_9[u4_bits >> 8]; u4_sym_len = (DecodedValue & 0xf); u4_level = DecodedValue >> 9; /* One table lookup */ if(0 != u4_level) { u4_run = ((DecodedValue >> 4) & 0x1f); u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } else { if (DecodedValue == END_OF_BLOCK_ONE) { u4_sym_len = 4; break; } else { /*Second table lookup*/ lead_zeros = CLZ(u4_bits) - 20;/* -16 since we are dealing with WORD32 */ if (0 != lead_zeros) { u4_bits = (u4_bits >> (6 - lead_zeros)) & 0x001F; /* Flush the number of bits */ if (1 == lead_zeros) { u4_sym_len = ((u4_bits & 0x18) >> 3) == 2 ? 11:10; } else { u4_sym_len = 11 + lead_zeros; } /* flushing */ FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) /* Calculate the address */ u4_bits = ((lead_zeros - 1) << 5) + u4_bits; DecodedValue = gau2_impeg2d_tab_one_10_16[u4_bits]; u4_run = BITS(DecodedValue, 8,4); u4_level = ((WORD16) DecodedValue) >> 9; u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } /*********************************************************************/ /* MPEG2 Escape Code */ /*********************************************************************/ else if(u2_mpeg2 == 1) { u4_sym_len = 6; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,18) u4_decoded_value = u4_bits; u4_run = (u4_decoded_value >> 12); u4_level = (u4_decoded_value & 0x0FFF); if (u4_level) u4_level = (u4_level - ((u4_level & 0x0800) << 1)); u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } /*********************************************************************/ /* MPEG1 Escape Code */ /*********************************************************************/ else { /*----------------------------------------------------------- * MPEG-1 Stream * * <See D.9.3 of MPEG-2> Run-level escape syntax * Run-level values that cannot be coded with a VLC are coded * by the escape code '0000 01' followed by * either a 14-bit FLC (127 <= level <= 127), * or a 22-bit FLC (255 <= level <= 255). * This is described in Annex B,B.5f of MPEG-1.standard *-----------------------------------------------------------*/ /*----------------------------------------------------------- * First 6 bits are the value of the Run. Next is First 8 bits * of Level. These bits decide whether it is 14 bit FLC or * 22-bit FLC. * * If( first 8 bits of Level == '1000000' or '00000000') * then its is 22-bit FLC. * else * it is 14-bit FLC. *-----------------------------------------------------------*/ u4_sym_len = 6; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,14) u4_decoded_value = u4_bits; u4_run = (u4_decoded_value >> 8); u4_level_first_byte = (u4_decoded_value & 0x0FF); if(u4_level_first_byte & 0x7F) { /*------------------------------------------------------- * First 8 bits of level are neither 1000000 nor 00000000 * Hence 14-bit FLC (Last 8 bits are used to get level) * * Level = (msb of Level_First_Byte is 1)? * Level_First_Byte - 256 : Level_First_Byte *-------------------------------------------------------*/ u4_level = (u4_level_first_byte - ((u4_level_first_byte & 0x80) << 1)); } else { /*------------------------------------------------------- * Next 8 bits are either 1000000 or 00000000 * Hence 22-bit FLC (Last 16 bits are used to get level) * * Level = (msb of Level_First_Byte is 1)? * Level_Second_Byte - 256 : Level_Second_Byte *-------------------------------------------------------*/ IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,8) u4_level = u4_bits; u4_level = (u4_level - (u4_level_first_byte << 1)); } u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } } } u4_nz_cols |= 1 << (u4_pos & 0x7); u4_nz_rows |= 1 << (u4_pos >> 0x3); } IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,u4_sym_len) if (u4_numCoeffs > 64) { return IMPEG2D_MB_TEX_DECODE_ERR; } } else { // Inline while(1) { UWORD32 lead_zeros; UWORD16 DecodedValue; u4_sym_len = 17; IBITS_NXT(u4_buf, u4_buf_nxt, u4_offset, u4_bits, u4_sym_len) DecodedValue = gau2_impeg2d_tab_zero_1_9[u4_bits >> 8]; u4_sym_len = BITS(DecodedValue, 3, 0); u4_level = ((WORD16) DecodedValue) >> 9; if (0 != u4_level) { u4_run = BITS(DecodedValue, 8,4); u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } else { if(DecodedValue == END_OF_BLOCK_ZERO) { u4_sym_len = 2; break; } else { lead_zeros = CLZ(u4_bits) - 20;/* -15 since we are dealing with WORD32 */ /*Second table lookup*/ if (0 != lead_zeros) { u4_bits = (u4_bits >> (6 - lead_zeros)) & 0x001F; /* Flush the number of bits */ u4_sym_len = 11 + lead_zeros; /* Calculate the address */ u4_bits = ((lead_zeros - 1) << 5) + u4_bits; DecodedValue = gau2_impeg2d_tab_zero_10_16[u4_bits]; u4_run = BITS(DecodedValue, 8,4); u4_level = ((WORD16) DecodedValue) >> 9; u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; if (1 == lead_zeros) u4_sym_len--; /* flushing */ FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } /*Escape Sequence*/ else if(u2_mpeg2 == 1) { u4_sym_len = 6; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,18) u4_decoded_value = u4_bits; u4_run = (u4_decoded_value >> 12); u4_level = (u4_decoded_value & 0x0FFF); if (u4_level) u4_level = (u4_level - ((u4_level & 0x0800) << 1)); u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } /*********************************************************************/ /* MPEG1 Escape Code */ /*********************************************************************/ else { /*----------------------------------------------------------- * MPEG-1 Stream * * <See D.9.3 of MPEG-2> Run-level escape syntax * Run-level values that cannot be coded with a VLC are coded * by the escape code '0000 01' followed by * either a 14-bit FLC (127 <= level <= 127), * or a 22-bit FLC (255 <= level <= 255). * This is described in Annex B,B.5f of MPEG-1.standard *-----------------------------------------------------------*/ /*----------------------------------------------------------- * First 6 bits are the value of the Run. Next is First 8 bits * of Level. These bits decide whether it is 14 bit FLC or * 22-bit FLC. * * If( first 8 bits of Level == '1000000' or '00000000') * then its is 22-bit FLC. * else * it is 14-bit FLC. *-----------------------------------------------------------*/ u4_sym_len = 6; FLUSH_BITS(u4_offset,u4_buf,u4_buf_nxt,u4_sym_len,pu4_buf_aligned) IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,14) u4_decoded_value = u4_bits; u4_run = (u4_decoded_value >> 8); u4_level_first_byte = (u4_decoded_value & 0x0FF); if(u4_level_first_byte & 0x7F) { /*------------------------------------------------------- * First 8 bits of level are neither 1000000 nor 00000000 * Hence 14-bit FLC (Last 8 bits are used to get level) * * Level = (msb of Level_First_Byte is 1)? * Level_First_Byte - 256 : Level_First_Byte *-------------------------------------------------------*/ u4_level = (u4_level_first_byte - ((u4_level_first_byte & 0x80) << 1)); } else { /*------------------------------------------------------- * Next 8 bits are either 1000000 or 00000000 * Hence 22-bit FLC (Last 16 bits are used to get level) * * Level = (msb of Level_First_Byte is 1)? * Level_Second_Byte - 256 : Level_Second_Byte *-------------------------------------------------------*/ IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,8) u4_level = u4_bits; u4_level = (u4_level - (u4_level_first_byte << 1)); } u4_numCoeffs += u4_run; u4_pos = pu1_scan[u4_numCoeffs++ & 63]; pu1_pos[*pi4_num_coeffs] = u4_pos; pi2_outAddr[*pi4_num_coeffs] = u4_level; (*pi4_num_coeffs)++; } } } u4_nz_cols |= 1 << (u4_pos & 0x7); u4_nz_rows |= 1 << (u4_pos >> 0x3); } if (u4_numCoeffs > 64) { return IMPEG2D_MB_TEX_DECODE_ERR; } IBITS_GET(u4_buf,u4_buf_nxt,u4_offset,u4_bits,pu4_buf_aligned,u4_sym_len) } PUT_TEMP_STREAM_DATA(u4_buf, u4_buf_nxt, u4_offset, pu4_buf_aligned, ps_stream) ps_dec->u4_non_zero_cols = u4_nz_cols; ps_dec->u4_non_zero_rows = u4_nz_rows; return (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE; }
5,122
115,198
0
gfx::Font OmniboxViewWin::GetFont() { return font_; }
5,123
124,588
0
LayoutUnit RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) { if (rootBlock != this) return containingBlock()->logicalRightSelectionOffset(rootBlock, position + logicalTop()); return logicalRightOffsetForContent(); }
5,124
51,153
0
static enum audit_state audit_filter_task(struct task_struct *tsk, char **key) { struct audit_entry *e; enum audit_state state; rcu_read_lock(); list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TASK], list) { if (audit_filter_rules(tsk, &e->rule, NULL, NULL, &state, true)) { if (state == AUDIT_RECORD_CONTEXT) *key = kstrdup(e->rule.filterkey, GFP_ATOMIC); rcu_read_unlock(); return state; } } rcu_read_unlock(); return AUDIT_BUILD_CONTEXT; }
5,125
104,296
0
bool RTCPeerConnectionHandlerChromium::updateIce(PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints) { if (!m_webHandler) return false; return m_webHandler->updateICE(configuration, constraints); }
5,126
59,034
0
static void dbus_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) { tcmu_dbg("name lost\n"); }
5,127
166,781
0
void NormalPageArena::TakeFreelistSnapshot(const String& dump_name) { if (free_list_.TakeSnapshot(dump_name)) { base::trace_event::MemoryAllocatorDump* buckets_dump = BlinkGCMemoryDumpProvider::Instance() ->CreateMemoryAllocatorDumpForCurrentGC(dump_name + "/buckets"); base::trace_event::MemoryAllocatorDump* pages_dump = BlinkGCMemoryDumpProvider::Instance() ->CreateMemoryAllocatorDumpForCurrentGC(dump_name + "/pages"); BlinkGCMemoryDumpProvider::Instance() ->CurrentProcessMemoryDump() ->AddOwnershipEdge(pages_dump->guid(), buckets_dump->guid()); } }
5,128
96,368
0
NDIS_STATUS ParaNdis_FinishSpecificInitialization(PARANDIS_ADAPTER *pContext) { NDIS_STATUS status = NDIS_STATUS_SUCCESS; NET_BUFFER_LIST_POOL_PARAMETERS PoolParams; NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS mic; DEBUG_ENTRY(0); NdisZeroMemory(&mic, sizeof(mic)); mic.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_INTERRUPT; mic.Header.Revision = NDIS_MINIPORT_INTERRUPT_REVISION_1; mic.Header.Size = NDIS_SIZEOF_MINIPORT_INTERRUPT_CHARACTERISTICS_REVISION_1; mic.DisableInterruptHandler = MiniportDisableInterruptEx; mic.EnableInterruptHandler = MiniportEnableInterruptEx; mic.InterruptDpcHandler = MiniportInterruptDPC; mic.InterruptHandler = MiniportInterrupt; if (pContext->bUsingMSIX) { mic.MsiSupported = TRUE; mic.MsiSyncWithAllMessages = TRUE; mic.EnableMessageInterruptHandler = MiniportEnableMSIInterrupt; mic.DisableMessageInterruptHandler = MiniportDisableMSIInterrupt; mic.MessageInterruptHandler = MiniportMSIInterrupt; mic.MessageInterruptDpcHandler = MiniportMSIInterruptDpc; } PoolParams.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; PoolParams.Header.Size = sizeof(PoolParams); PoolParams.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; PoolParams.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; PoolParams.fAllocateNetBuffer = TRUE; PoolParams.ContextSize = 0; PoolParams.PoolTag = PARANDIS_MEMORY_TAG; PoolParams.DataSize = 0; pContext->BufferListsPool = NdisAllocateNetBufferListPool(pContext->MiniportHandle, &PoolParams); if (!pContext->BufferListsPool) { status = NDIS_STATUS_RESOURCES; } if (status == NDIS_STATUS_SUCCESS) { status = NdisMRegisterInterruptEx(pContext->MiniportHandle, pContext, &mic, &pContext->InterruptHandle); } #ifdef DBG if (pContext->bUsingMSIX) { DPrintf(0, ("[%s] MSIX message table %savailable, count = %u\n", __FUNCTION__, (mic.MessageInfoTable == nullptr ? "not " : ""), (mic.MessageInfoTable == nullptr ? 0 : mic.MessageInfoTable->MessageCount))); } else { DPrintf(0, ("[%s] Not using MSIX\n", __FUNCTION__)); } #endif if (status == NDIS_STATUS_SUCCESS) { NDIS_SG_DMA_DESCRIPTION sgDesc; sgDesc.Header.Type = NDIS_OBJECT_TYPE_SG_DMA_DESCRIPTION; sgDesc.Header.Revision = NDIS_SG_DMA_DESCRIPTION_REVISION_1; sgDesc.Header.Size = sizeof(sgDesc); sgDesc.Flags = NDIS_SG_DMA_64_BIT_ADDRESS; sgDesc.MaximumPhysicalMapping = 0x10000; // 64K sgDesc.ProcessSGListHandler = ProcessSGListHandler; sgDesc.SharedMemAllocateCompleteHandler = SharedMemAllocateCompleteHandler; sgDesc.ScatterGatherListSize = 0; // OUT value status = NdisMRegisterScatterGatherDma(pContext->MiniportHandle, &sgDesc, &pContext->DmaHandle); if (status != NDIS_STATUS_SUCCESS) { DPrintf(0, ("[%s] ERROR: NdisMRegisterScatterGatherDma failed (%X)!\n", __FUNCTION__, status)); } else { DPrintf(0, ("[%s] SG recommended size %d\n", __FUNCTION__, sgDesc.ScatterGatherListSize)); } } if (status == NDIS_STATUS_SUCCESS) { if (NDIS_CONNECT_MESSAGE_BASED == mic.InterruptType) { pContext->pMSIXInfoTable = mic.MessageInfoTable; } else if (pContext->bUsingMSIX) { DPrintf(0, ("[%s] ERROR: Interrupt type %d, message table %p\n", __FUNCTION__, mic.InterruptType, mic.MessageInfoTable)); status = NDIS_STATUS_RESOURCE_CONFLICT; } ParaNdis6_ApplyOffloadPersistentConfiguration(pContext); DebugParseOffloadBits(); } DEBUG_EXIT_STATUS(0, status); return status; }
5,129
140,434
0
const ContentSuggestion* GetSuggestionToNotifyAbout(Category category) { const auto& suggestions = service_->GetSuggestionsForCategory(category); if (variations::GetVariationParamByFeatureAsBool( kContentSuggestionsNotificationsFeature, kContentSuggestionsNotificationsAlwaysNotifyParam, false)) { if (category.IsKnownCategory(KnownCategories::ARTICLES) && !suggestions.empty()) { return &suggestions[0]; } return nullptr; } for (const ContentSuggestion& suggestion : suggestions) { if (suggestion.notification_extra()) { return &suggestion; } } return nullptr; }
5,130
178,959
1
asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long write, unsigned long address) { struct vm_area_struct * vma = NULL; struct task_struct *tsk = current; struct mm_struct *mm = tsk->mm; const int field = sizeof(unsigned long) * 2; siginfo_t info; int fault; #if 0 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(), current->comm, current->pid, field, address, write, field, regs->cp0_epc); #endif #ifdef CONFIG_KPROBES /* * This is to notify the fault handler of the kprobes. The * exception code is redundant as it is also carried in REGS, * but we pass it anyhow. */ if (notify_die(DIE_PAGE_FAULT, "page fault", regs, -1, (regs->cp0_cause >> 2) & 0x1f, SIGSEGV) == NOTIFY_STOP) return; #endif info.si_code = SEGV_MAPERR; /* * We fault-in kernel-space virtual memory on-demand. The * 'reference' page table is init_mm.pgd. * * NOTE! We MUST NOT take any locks for this case. We may * be in an interrupt or a critical region, and should * only copy the information from the master page table, * nothing more. */ #ifdef CONFIG_64BIT # define VMALLOC_FAULT_TARGET no_context #else # define VMALLOC_FAULT_TARGET vmalloc_fault #endif if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END)) goto VMALLOC_FAULT_TARGET; #ifdef MODULE_START if (unlikely(address >= MODULE_START && address < MODULE_END)) goto VMALLOC_FAULT_TARGET; #endif /* * If we're in an interrupt or have no user * context, we must not take the fault.. */ if (in_atomic() || !mm) goto bad_area_nosemaphore; down_read(&mm->mmap_sem); vma = find_vma(mm, address); if (!vma) goto bad_area; if (vma->vm_start <= address) goto good_area; if (!(vma->vm_flags & VM_GROWSDOWN)) goto bad_area; if (expand_stack(vma, address)) goto bad_area; /* * Ok, we have a good vm_area for this memory access, so * we can handle it.. */ good_area: info.si_code = SEGV_ACCERR; if (write) { if (!(vma->vm_flags & VM_WRITE)) goto bad_area; } else { if (kernel_uses_smartmips_rixi) { if (address == regs->cp0_epc && !(vma->vm_flags & VM_EXEC)) { #if 0 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] XI violation\n", raw_smp_processor_id(), current->comm, current->pid, field, address, write, field, regs->cp0_epc); #endif goto bad_area; } if (!(vma->vm_flags & VM_READ)) { #if 0 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n", raw_smp_processor_id(), current->comm, current->pid, field, address, write, field, regs->cp0_epc); #endif goto bad_area; } } else { if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) goto bad_area; } } /* * If for any reason at all we couldn't handle the fault, * make sure we exit gracefully rather than endlessly redo * the fault. */ fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); if (unlikely(fault & VM_FAULT_ERROR)) { if (fault & VM_FAULT_OOM) goto out_of_memory; else if (fault & VM_FAULT_SIGBUS) goto do_sigbus; BUG(); } if (fault & VM_FAULT_MAJOR) { perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, address); tsk->maj_flt++; } else { perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, address); tsk->min_flt++; } up_read(&mm->mmap_sem); return; /* * Something tried to access memory that isn't in our memory map.. * Fix it, but check if it's kernel or user first.. */ bad_area: up_read(&mm->mmap_sem); bad_area_nosemaphore: /* User mode accesses just cause a SIGSEGV */ if (user_mode(regs)) { tsk->thread.cp0_badvaddr = address; tsk->thread.error_code = write; #if 0 printk("do_page_fault() #2: sending SIGSEGV to %s for " "invalid %s\n%0*lx (epc == %0*lx, ra == %0*lx)\n", tsk->comm, write ? "write access to" : "read access from", field, address, field, (unsigned long) regs->cp0_epc, field, (unsigned long) regs->regs[31]); #endif info.si_signo = SIGSEGV; info.si_errno = 0; /* info.si_code has been set above */ info.si_addr = (void __user *) address; force_sig_info(SIGSEGV, &info, tsk); return; } no_context: /* Are we prepared to handle this kernel fault? */ if (fixup_exception(regs)) { current->thread.cp0_baduaddr = address; return; } /* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. */ bust_spinlocks(1); printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at " "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n", raw_smp_processor_id(), field, address, field, regs->cp0_epc, field, regs->regs[31]); die("Oops", regs); out_of_memory: /* * We ran out of memory, call the OOM killer, and return the userspace * (which will retry the fault, or kill us if we got oom-killed). */ up_read(&mm->mmap_sem); pagefault_out_of_memory(); return; do_sigbus: up_read(&mm->mmap_sem); /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) goto no_context; else /* * Send a sigbus, regardless of whether we were in kernel * or user mode. */ #if 0 printk("do_page_fault() #3: sending SIGBUS to %s for " "invalid %s\n%0*lx (epc == %0*lx, ra == %0*lx)\n", tsk->comm, write ? "write access to" : "read access from", field, address, field, (unsigned long) regs->cp0_epc, field, (unsigned long) regs->regs[31]); #endif tsk->thread.cp0_badvaddr = address; info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRERR; info.si_addr = (void __user *) address; force_sig_info(SIGBUS, &info, tsk); return; #ifndef CONFIG_64BIT vmalloc_fault: { /* * Synchronize this task's top level page-table * with the 'reference' page table. * * Do _not_ use "tsk" here. We might be inside * an interrupt in the middle of a task switch.. */ int offset = __pgd_offset(address); pgd_t *pgd, *pgd_k; pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; pte_t *pte_k; pgd = (pgd_t *) pgd_current[raw_smp_processor_id()] + offset; pgd_k = init_mm.pgd + offset; if (!pgd_present(*pgd_k)) goto no_context; set_pgd(pgd, *pgd_k); pud = pud_offset(pgd, address); pud_k = pud_offset(pgd_k, address); if (!pud_present(*pud_k)) goto no_context; pmd = pmd_offset(pud, address); pmd_k = pmd_offset(pud_k, address); if (!pmd_present(*pmd_k)) goto no_context; set_pmd(pmd, *pmd_k); pte_k = pte_offset_kernel(pmd_k, address); if (!pte_present(*pte_k)) goto no_context; return; } #endif }
5,131
18,815
0
void cipso_v4_doi_free(struct cipso_v4_doi *doi_def) { if (doi_def == NULL) return; switch (doi_def->type) { case CIPSO_V4_MAP_TRANS: kfree(doi_def->map.std->lvl.cipso); kfree(doi_def->map.std->lvl.local); kfree(doi_def->map.std->cat.cipso); kfree(doi_def->map.std->cat.local); break; } kfree(doi_def); }
5,132
167,783
0
void WebRuntimeFeatures::EnableVideoFullscreenOrientationLock(bool enable) { RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled(enable); }
5,133
187,859
1
void CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_, long long size_) { const long long stop = start_ + size_; long long pos = start_; m_track = -1; m_pos = -1; m_block = 1; // default while (pos < stop) { long len; const long long id = ReadUInt(pReader, pos, len); assert(id >= 0); // TODO assert((pos + len) <= stop); pos += len; // consume ID const long long size = ReadUInt(pReader, pos, len); assert(size >= 0); assert((pos + len) <= stop); pos += len; // consume Size field assert((pos + size) <= stop); if (id == 0x77) // CueTrack ID m_track = UnserializeUInt(pReader, pos, size); else if (id == 0x71) // CueClusterPos ID m_pos = UnserializeUInt(pReader, pos, size); else if (id == 0x1378) // CueBlockNumber m_block = UnserializeUInt(pReader, pos, size); pos += size; // consume payload assert(pos <= stop); } assert(m_pos >= 0); assert(m_track > 0); // assert(m_block > 0); }
5,134
144,549
0
const base::string16& WebContentsImpl::GetTitle() const { NavigationEntry* entry = controller_.GetTransientEntry(); std::string accept_languages = GetContentClient()->browser()->GetAcceptLangs( GetBrowserContext()); if (entry) { return entry->GetTitleForDisplay(accept_languages); } WebUI* navigating_web_ui = GetRenderManager()->GetNavigatingWebUI(); WebUI* our_web_ui = navigating_web_ui ? navigating_web_ui : GetRenderManager()->current_frame_host()->web_ui(); if (our_web_ui) { entry = controller_.GetVisibleEntry(); if (!(entry && entry->IsViewSourceMode())) { const base::string16& title = our_web_ui->GetOverriddenTitle(); if (!title.empty()) return title; } } entry = controller_.GetLastCommittedEntry(); if (controller_.IsInitialNavigation() && ((controller_.GetVisibleEntry() && !controller_.GetVisibleEntry()->GetTitle().empty()) || controller_.GetPendingEntryIndex() != -1)) { entry = controller_.GetVisibleEntry(); } if (entry) { return entry->GetTitleForDisplay(accept_languages); } return page_title_when_no_navigation_entry_; }
5,135
128,642
0
void CreateDefaultSearchWithAdditionalJsonData( const std::string additional_json_data) { CreateDefaultSearchContextAndRequestSearchTerm(); fetcher()->set_response_code(200); std::string response = escapeBarQuoted("{|search_term|:|obama|" + additional_json_data + "}"); fetcher()->SetResponseString(response); fetcher()->delegate()->OnURLFetchComplete(fetcher()); EXPECT_FALSE(is_invalid()); EXPECT_EQ(200, response_code()); EXPECT_EQ("obama", search_term()); }
5,136
8,905
0
int vrend_renderer_get_poll_fd(void) { if (!vrend_state.inited) return -1; return vrend_state.eventfd; }
5,137
50,732
0
static void free_sockent_client (struct sockent_client *sec) /* {{{ */ { if (sec->fd >= 0) { close (sec->fd); sec->fd = -1; } sfree (sec->addr); #if HAVE_LIBGCRYPT sfree (sec->username); sfree (sec->password); if (sec->cypher != NULL) gcry_cipher_close (sec->cypher); #endif } /* }}} void free_sockent_client */
5,138
187,711
1
static size_t safecat(char *buffer, size_t bufsize, size_t pos, PNG_CONST char *cat) { while (pos < bufsize && cat != NULL && *cat != 0) buffer[pos++] = *cat++; if (pos >= bufsize) pos = bufsize-1; buffer[pos] = 0; return pos; }
5,139
162,650
0
void HeadlessPrintManager::ReleaseJob(PrintResult result) { if (!callback_) { DLOG(ERROR) << "ReleaseJob is called when callback_ is null. Check whether " "ReleaseJob is called more than once."; return; } if (result == PRINT_SUCCESS) callback_.Run(result, std::move(data_)); else callback_.Run(result, std::string()); printing_rfh_->Send(new PrintMsg_PrintingDone(printing_rfh_->GetRoutingID(), result == PRINT_SUCCESS)); Reset(); }
5,140
1,721
0
gx_dc_pattern2_save_dc( const gx_device_color * pdevc, gx_device_color_saved * psdc ) { gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern; psdc->type = pdevc->type; psdc->colors.pattern2.id = pinst->pattern_id; psdc->colors.pattern2.shfill = pinst->shfill; }
5,141
867
0
void ArthurOutputDev::updateFillOpacity(GfxState *state) { QColor brushColour= m_currentBrush.color(); brushColour.setAlphaF(state->getFillOpacity()); m_currentBrush.setColor(brushColour); }
5,142
21,582
0
__releases(rcu) { struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); if (likely(state->im != NULL)) { spin_unlock_bh(&state->im->lock); state->im = NULL; } state->idev = NULL; state->dev = NULL; rcu_read_unlock(); }
5,143
62,960
0
static int handle_cr(struct kvm_vcpu *vcpu) { unsigned long exit_qualification, val; int cr; int reg; int err; int ret; exit_qualification = vmcs_readl(EXIT_QUALIFICATION); cr = exit_qualification & 15; reg = (exit_qualification >> 8) & 15; switch ((exit_qualification >> 4) & 3) { case 0: /* mov to cr */ val = kvm_register_readl(vcpu, reg); trace_kvm_cr_write(cr, val); switch (cr) { case 0: err = handle_set_cr0(vcpu, val); return kvm_complete_insn_gp(vcpu, err); case 3: err = kvm_set_cr3(vcpu, val); return kvm_complete_insn_gp(vcpu, err); case 4: err = handle_set_cr4(vcpu, val); return kvm_complete_insn_gp(vcpu, err); case 8: { u8 cr8_prev = kvm_get_cr8(vcpu); u8 cr8 = (u8)val; err = kvm_set_cr8(vcpu, cr8); ret = kvm_complete_insn_gp(vcpu, err); if (lapic_in_kernel(vcpu)) return ret; if (cr8_prev <= cr8) return ret; /* * TODO: we might be squashing a * KVM_GUESTDBG_SINGLESTEP-triggered * KVM_EXIT_DEBUG here. */ vcpu->run->exit_reason = KVM_EXIT_SET_TPR; return 0; } } break; case 2: /* clts */ WARN_ONCE(1, "Guest should always own CR0.TS"); vmx_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~X86_CR0_TS)); trace_kvm_cr_write(0, kvm_read_cr0(vcpu)); return kvm_skip_emulated_instruction(vcpu); case 1: /*mov from cr*/ switch (cr) { case 3: val = kvm_read_cr3(vcpu); kvm_register_write(vcpu, reg, val); trace_kvm_cr_read(cr, val); return kvm_skip_emulated_instruction(vcpu); case 8: val = kvm_get_cr8(vcpu); kvm_register_write(vcpu, reg, val); trace_kvm_cr_read(cr, val); return kvm_skip_emulated_instruction(vcpu); } break; case 3: /* lmsw */ val = (exit_qualification >> LMSW_SOURCE_DATA_SHIFT) & 0x0f; trace_kvm_cr_write(0, (kvm_read_cr0(vcpu) & ~0xful) | val); kvm_lmsw(vcpu, val); return kvm_skip_emulated_instruction(vcpu); default: break; } vcpu->run->exit_reason = 0; vcpu_unimpl(vcpu, "unhandled control register: op %d cr %d\n", (int)(exit_qualification >> 4) & 3, cr); return 0; }
5,144
179,999
1
int dtls1_get_record(SSL *s) { int ssl_major,ssl_minor; int i,n; SSL3_RECORD *rr; unsigned char *p = NULL; unsigned short version; DTLS1_BITMAP *bitmap; unsigned int is_next_epoch; rr= &(s->s3->rrec); /* The epoch may have changed. If so, process all the * pending records. This is a non-blocking operation. */ dtls1_process_buffered_records(s); /* if we're renegotiating, then there may be buffered records */ if (dtls1_get_processed_record(s)) return 1; /* get something from the wire */ again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < DTLS1_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, DTLS1_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); /* read timeout is handled by dtls1_read_bytes */ if (n <= 0) return(n); /* error or non-blocking */ /* this packet contained a partial record, dump it */ if (s->packet_length != DTLS1_RT_HEADER_LENGTH) { s->packet_length = 0; goto again; } s->rstate=SSL_ST_READ_BODY; p=s->packet; if (s->msg_callback) s->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg); /* Pull apart the header into the DTLS1_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; /* sequence number is 64 bits, with top 2 bytes = epoch */ n2s(p,rr->epoch); memcpy(&(s->s3->read_sequence[2]), p, 6); p+=6; n2s(p,rr->length); /* Lets check version */ if (!s->first_packet) { if (version != s->version) { /* unexpected version, silently discard */ rr->length = 0; s->packet_length = 0; goto again; } } if ((version & 0xff00) != (s->version & 0xff00)) { /* wrong version, silently discard record */ rr->length = 0; s->packet_length = 0; goto again; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) { /* record too long, silently discard it */ rr->length = 0; s->packet_length = 0; goto again; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-DTLS1_RT_HEADER_LENGTH) { /* now s->packet_length == DTLS1_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); /* this packet contained a partial record, dump it */ if ( n != i) { rr->length = 0; s->packet_length = 0; goto again; } /* now n == rr->length, * and s->packet_length == DTLS1_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* match epochs. NULL means the packet is dropped on the floor */ bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch); if ( bitmap == NULL) { rr->length = 0; s->packet_length = 0; /* dump this record */ goto again; /* get another record */ } #ifndef OPENSSL_NO_SCTP /* Only do replay check if no SCTP bio */ if (!BIO_dgram_is_sctp(SSL_get_rbio(s))) { #endif /* Check whether this is a repeat, or aged record. * Don't check if we're listening and this message is * a ClientHello. They can look as if they're replayed, * since they arrive from different connections and * would be dropped unnecessarily. */ if (!(s->d1->listen && rr->type == SSL3_RT_HANDSHAKE && *p == SSL3_MT_CLIENT_HELLO) && !dtls1_record_replay_check(s, bitmap)) { rr->length = 0; s->packet_length=0; /* dump this record */ goto again; /* get another record */ } #ifndef OPENSSL_NO_SCTP } #endif /* just read a 0 length packet */ if (rr->length == 0) goto again; /* If this record is from the next epoch (either HM or ALERT), * and a handshake is currently in progress, buffer it since it * cannot be processed at this time. However, do not buffer * anything while listening. */ if (is_next_epoch) { if ((SSL_in_init(s) || s->in_handshake) && !s->d1->listen) { dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), rr->seq_num); } rr->length = 0; s->packet_length = 0; goto again; } if (!dtls1_process_record(s)) { rr->length = 0; s->packet_length = 0; /* dump this record */ goto again; /* get another record */ } return(1); }
5,145
145,673
0
ExtensionViewGuest::ExtensionViewGuest(WebContents* owner_web_contents) : GuestView<ExtensionViewGuest>(owner_web_contents) {}
5,146
179,597
1
PHP_FUNCTION(imagesetstyle) { zval *IM, *styles; gdImagePtr im; int * stylearr; int index; HashPosition pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &IM, &styles) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); /* copy the style values in the stylearr */ stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0); zend_hash_internal_pointer_reset_ex(HASH_OF(styles), &pos); for (index = 0;; zend_hash_move_forward_ex(HASH_OF(styles), &pos)) { zval ** item; if (zend_hash_get_current_data_ex(HASH_OF(styles), (void **) &item, &pos) == FAILURE) { break; } convert_to_long_ex(item); stylearr[index++] = Z_LVAL_PP(item); } gdImageSetStyle(im, stylearr, index); efree(stylearr); RETURN_TRUE; }
5,147
44,408
0
int lxcfs_chown(const char *path, uid_t uid, gid_t gid) { if (strncmp(path, "/cgroup", 7) == 0) return cg_chown(path, uid, gid); return -EINVAL; }
5,148
111,467
0
bool InputHandler::executeTextEditCommand(const WTF::String& commandName) { ASSERT(m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->editor()); Editor* editor = m_webPage->focusedOrMainFrame()->editor(); return editor->command(commandName).execute(); }
5,149
154,238
0
error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::GetShaderInfoLog& c = *static_cast<const volatile gles2::cmds::GetShaderInfoLog*>(cmd_data); GLuint shader_id = c.shader; uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); Bucket* bucket = CreateBucket(bucket_id); Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); if (!shader) { bucket->SetFromString(""); return error::kNoError; } CompileShaderAndExitCommandProcessingEarly(shader); bucket->SetFromString(shader->log_info().c_str()); return error::kNoError; }
5,150
62,244
0
bgp_attr_print(netdissect_options *ndo, u_int atype, const u_char *pptr, u_int len) { int i; uint16_t af; uint8_t safi, snpa, nhlen; union { /* copy buffer for bandwidth values */ float f; uint32_t i; } bw; int advance; u_int tlen; const u_char *tptr; char buf[MAXHOSTNAMELEN + 100]; int as_size; tptr = pptr; tlen=len; switch (atype) { case BGPTYPE_ORIGIN: if (len != 1) ND_PRINT((ndo, "invalid len")); else { ND_TCHECK(*tptr); ND_PRINT((ndo, "%s", tok2str(bgp_origin_values, "Unknown Origin Typecode", tptr[0]))); } break; /* * Process AS4 byte path and AS2 byte path attributes here. */ case BGPTYPE_AS4_PATH: case BGPTYPE_AS_PATH: if (len % 2) { ND_PRINT((ndo, "invalid len")); break; } if (!len) { ND_PRINT((ndo, "empty")); break; } /* * BGP updates exchanged between New speakers that support 4 * byte AS, ASs are always encoded in 4 bytes. There is no * definitive way to find this, just by the packet's * contents. So, check for packet's TLV's sanity assuming * 2 bytes first, and it does not pass, assume that ASs are * encoded in 4 bytes format and move on. */ as_size = bgp_attr_get_as_size(ndo, atype, pptr, len); while (tptr < pptr + len) { ND_TCHECK(tptr[0]); ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_open_values, "?", tptr[0]))); ND_TCHECK(tptr[1]); for (i = 0; i < tptr[1] * as_size; i += as_size) { ND_TCHECK2(tptr[2 + i], as_size); ND_PRINT((ndo, "%s ", as_printf(ndo, astostr, sizeof(astostr), as_size == 2 ? EXTRACT_16BITS(&tptr[2 + i]) : EXTRACT_32BITS(&tptr[2 + i])))); } ND_TCHECK(tptr[0]); ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values, "?", tptr[0]))); ND_TCHECK(tptr[1]); tptr += 2 + tptr[1] * as_size; } break; case BGPTYPE_NEXT_HOP: if (len != 4) ND_PRINT((ndo, "invalid len")); else { ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr))); } break; case BGPTYPE_MULTI_EXIT_DISC: case BGPTYPE_LOCAL_PREF: if (len != 4) ND_PRINT((ndo, "invalid len")); else { ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "%u", EXTRACT_32BITS(tptr))); } break; case BGPTYPE_ATOMIC_AGGREGATE: if (len != 0) ND_PRINT((ndo, "invalid len")); break; case BGPTYPE_AGGREGATOR: /* * Depending on the AS encoded is of 2 bytes or of 4 bytes, * the length of this PA can be either 6 bytes or 8 bytes. */ if (len != 6 && len != 8) { ND_PRINT((ndo, "invalid len")); break; } ND_TCHECK2(tptr[0], len); if (len == 6) { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_16BITS(tptr)), ipaddr_string(ndo, tptr + 2))); } else { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)), ipaddr_string(ndo, tptr + 4))); } break; case BGPTYPE_AGGREGATOR4: if (len != 8) { ND_PRINT((ndo, "invalid len")); break; } ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)), ipaddr_string(ndo, tptr + 4))); break; case BGPTYPE_COMMUNITIES: if (len % 4) { ND_PRINT((ndo, "invalid len")); break; } while (tlen>0) { uint32_t comm; ND_TCHECK2(tptr[0], 4); comm = EXTRACT_32BITS(tptr); switch (comm) { case BGP_COMMUNITY_NO_EXPORT: ND_PRINT((ndo, " NO_EXPORT")); break; case BGP_COMMUNITY_NO_ADVERT: ND_PRINT((ndo, " NO_ADVERTISE")); break; case BGP_COMMUNITY_NO_EXPORT_SUBCONFED: ND_PRINT((ndo, " NO_EXPORT_SUBCONFED")); break; default: ND_PRINT((ndo, "%u:%u%s", (comm >> 16) & 0xffff, comm & 0xffff, (tlen>4) ? ", " : "")); break; } tlen -=4; tptr +=4; } break; case BGPTYPE_ORIGINATOR_ID: if (len != 4) { ND_PRINT((ndo, "invalid len")); break; } ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "%s",ipaddr_string(ndo, tptr))); break; case BGPTYPE_CLUSTER_LIST: if (len % 4) { ND_PRINT((ndo, "invalid len")); break; } while (tlen>0) { ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "%s%s", ipaddr_string(ndo, tptr), (tlen>4) ? ", " : "")); tlen -=4; tptr +=4; } break; case BGPTYPE_MP_REACH_NLRI: ND_TCHECK2(tptr[0], 3); af = EXTRACT_16BITS(tptr); safi = tptr[2]; ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", tok2str(af_values, "Unknown AFI", af), af, (safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */ tok2str(bgp_safi_values, "Unknown SAFI", safi), safi)); switch(af<<8 | safi) { case (AFNUM_INET<<8 | SAFNUM_UNICAST): case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): case (AFNUM_INET<<8 | SAFNUM_LABUNICAST): case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO): case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST): case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): case (AFNUM_INET<<8 | SAFNUM_MDT): case (AFNUM_INET6<<8 | SAFNUM_UNICAST): case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_UNICAST): case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST): case (AFNUM_VPLS<<8 | SAFNUM_VPLS): break; default: ND_TCHECK2(tptr[0], tlen); ND_PRINT((ndo, "\n\t no AFI %u / SAFI %u decoder", af, safi)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, tptr, "\n\t ", tlen); goto done; break; } tptr +=3; ND_TCHECK(tptr[0]); nhlen = tptr[0]; tlen = nhlen; tptr++; if (tlen) { int nnh = 0; ND_PRINT((ndo, "\n\t nexthop: ")); while (tlen > 0) { if ( nnh++ > 0 ) { ND_PRINT((ndo, ", " )); } switch(af<<8 | safi) { case (AFNUM_INET<<8 | SAFNUM_UNICAST): case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): case (AFNUM_INET<<8 | SAFNUM_LABUNICAST): case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO): case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): case (AFNUM_INET<<8 | SAFNUM_MDT): if (tlen < (int)sizeof(struct in_addr)) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in_addr)); ND_PRINT((ndo, "%s",ipaddr_string(ndo, tptr))); tlen -= sizeof(struct in_addr); tptr += sizeof(struct in_addr); } break; case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST): if (tlen < (int)(sizeof(struct in_addr)+BGP_VPN_RD_LEN)) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in_addr)+BGP_VPN_RD_LEN); ND_PRINT((ndo, "RD: %s, %s", bgp_vpn_rd_print(ndo, tptr), ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN))); tlen -= (sizeof(struct in_addr)+BGP_VPN_RD_LEN); tptr += (sizeof(struct in_addr)+BGP_VPN_RD_LEN); } break; case (AFNUM_INET6<<8 | SAFNUM_UNICAST): case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST): if (tlen < (int)sizeof(struct in6_addr)) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in6_addr)); ND_PRINT((ndo, "%s", ip6addr_string(ndo, tptr))); tlen -= sizeof(struct in6_addr); tptr += sizeof(struct in6_addr); } break; case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST): if (tlen < (int)(sizeof(struct in6_addr)+BGP_VPN_RD_LEN)) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in6_addr)+BGP_VPN_RD_LEN); ND_PRINT((ndo, "RD: %s, %s", bgp_vpn_rd_print(ndo, tptr), ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN))); tlen -= (sizeof(struct in6_addr)+BGP_VPN_RD_LEN); tptr += (sizeof(struct in6_addr)+BGP_VPN_RD_LEN); } break; case (AFNUM_VPLS<<8 | SAFNUM_VPLS): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST): if (tlen < (int)sizeof(struct in_addr)) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in_addr)); ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr))); tlen -= (sizeof(struct in_addr)); tptr += (sizeof(struct in_addr)); } break; case (AFNUM_NSAP<<8 | SAFNUM_UNICAST): case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST): ND_TCHECK2(tptr[0], tlen); ND_PRINT((ndo, "%s", isonsap_string(ndo, tptr, tlen))); tptr += tlen; tlen = 0; break; case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST): if (tlen < BGP_VPN_RD_LEN+1) { ND_PRINT((ndo, "invalid len")); tlen = 0; } else { ND_TCHECK2(tptr[0], tlen); ND_PRINT((ndo, "RD: %s, %s", bgp_vpn_rd_print(ndo, tptr), isonsap_string(ndo, tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN))); /* rfc986 mapped IPv4 address ? */ if (EXTRACT_32BITS(tptr+BGP_VPN_RD_LEN) == 0x47000601) ND_PRINT((ndo, " = %s", ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN+4))); /* rfc1888 mapped IPv6 address ? */ else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000) ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3))); tptr += tlen; tlen = 0; } break; default: ND_TCHECK2(tptr[0], tlen); ND_PRINT((ndo, "no AFI %u/SAFI %u decoder", af, safi)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, tptr, "\n\t ", tlen); tptr += tlen; tlen = 0; goto done; break; } } } ND_PRINT((ndo, ", nh-length: %u", nhlen)); tptr += tlen; ND_TCHECK(tptr[0]); snpa = tptr[0]; tptr++; if (snpa) { ND_PRINT((ndo, "\n\t %u SNPA", snpa)); for (/*nothing*/; snpa > 0; snpa--) { ND_TCHECK(tptr[0]); ND_PRINT((ndo, "\n\t %d bytes", tptr[0])); tptr += tptr[0] + 1; } } else { ND_PRINT((ndo, ", no SNPA")); } while (tptr < pptr + len) { switch (af<<8 | safi) { case (AFNUM_INET<<8 | SAFNUM_UNICAST): case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): advance = decode_prefix4(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_LABUNICAST): advance = decode_labeled_prefix4(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_prefix4(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO): advance = decode_rt_routing_info(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): /* fall through */ case (AFNUM_INET6<<8 | SAFNUM_MULTICAST_VPN): advance = decode_multicast_vpn(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_MDT): advance = decode_mdt_vpn_nlri(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_UNICAST): case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): advance = decode_prefix6(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST): advance = decode_labeled_prefix6(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_prefix6(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_VPLS<<8 | SAFNUM_VPLS): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_l2(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_NSAP<<8 | SAFNUM_UNICAST): case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST): advance = decode_clnp_prefix(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_clnp_prefix(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; default: ND_TCHECK2(*tptr,tlen); ND_PRINT((ndo, "\n\t no AFI %u / SAFI %u decoder", af, safi)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, tptr, "\n\t ", tlen); advance = 0; tptr = pptr + len; break; } if (advance < 0) break; tptr += advance; } done: break; case BGPTYPE_MP_UNREACH_NLRI: ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE); af = EXTRACT_16BITS(tptr); safi = tptr[2]; ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", tok2str(af_values, "Unknown AFI", af), af, (safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */ tok2str(bgp_safi_values, "Unknown SAFI", safi), safi)); if (len == BGP_MP_NLRI_MINSIZE) ND_PRINT((ndo, "\n\t End-of-Rib Marker (empty NLRI)")); tptr += 3; while (tptr < pptr + len) { switch (af<<8 | safi) { case (AFNUM_INET<<8 | SAFNUM_UNICAST): case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): advance = decode_prefix4(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_LABUNICAST): advance = decode_labeled_prefix4(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_prefix4(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_UNICAST): case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): advance = decode_prefix6(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST): advance = decode_labeled_prefix6(ndo, tptr, len, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else if (advance == -3) break; /* bytes left, but not enough */ else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_prefix6(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_VPLS<<8 | SAFNUM_VPLS): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_l2(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_NSAP<<8 | SAFNUM_UNICAST): case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST): advance = decode_clnp_prefix(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST): case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST): advance = decode_labeled_vpn_clnp_prefix(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_MDT): advance = decode_mdt_vpn_nlri(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): /* fall through */ case (AFNUM_INET6<<8 | SAFNUM_MULTICAST_VPN): advance = decode_multicast_vpn(ndo, tptr, buf, sizeof(buf)); if (advance == -1) ND_PRINT((ndo, "\n\t (illegal prefix length)")); else if (advance == -2) goto trunc; else ND_PRINT((ndo, "\n\t %s", buf)); break; default: ND_TCHECK2(*(tptr-3),tlen); ND_PRINT((ndo, "no AFI %u / SAFI %u decoder", af, safi)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, tptr-3, "\n\t ", tlen); advance = 0; tptr = pptr + len; break; } if (advance < 0) break; tptr += advance; } break; case BGPTYPE_EXTD_COMMUNITIES: if (len % 8) { ND_PRINT((ndo, "invalid len")); break; } while (tlen>0) { uint16_t extd_comm; ND_TCHECK2(tptr[0], 2); extd_comm=EXTRACT_16BITS(tptr); ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]", tok2str(bgp_extd_comm_subtype_values, "unknown extd community typecode", extd_comm), extd_comm, bittok2str(bgp_extd_comm_flag_values, "none", extd_comm))); ND_TCHECK2(*(tptr+2), 6); switch(extd_comm) { case BGP_EXT_COM_RT_0: case BGP_EXT_COM_RO_0: case BGP_EXT_COM_L2VPN_RT_0: ND_PRINT((ndo, ": %u:%u (= %s)", EXTRACT_16BITS(tptr+2), EXTRACT_32BITS(tptr+4), ipaddr_string(ndo, tptr+4))); break; case BGP_EXT_COM_RT_1: case BGP_EXT_COM_RO_1: case BGP_EXT_COM_L2VPN_RT_1: case BGP_EXT_COM_VRF_RT_IMP: ND_PRINT((ndo, ": %s:%u", ipaddr_string(ndo, tptr+2), EXTRACT_16BITS(tptr+6))); break; case BGP_EXT_COM_RT_2: case BGP_EXT_COM_RO_2: ND_PRINT((ndo, ": %s:%u", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr+2)), EXTRACT_16BITS(tptr+6))); break; case BGP_EXT_COM_LINKBAND: bw.i = EXTRACT_32BITS(tptr+2); ND_PRINT((ndo, ": bandwidth: %.3f Mbps", bw.f*8/1000000)); break; case BGP_EXT_COM_VPN_ORIGIN: case BGP_EXT_COM_VPN_ORIGIN2: case BGP_EXT_COM_VPN_ORIGIN3: case BGP_EXT_COM_VPN_ORIGIN4: case BGP_EXT_COM_OSPF_RID: case BGP_EXT_COM_OSPF_RID2: ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr+2))); break; case BGP_EXT_COM_OSPF_RTYPE: case BGP_EXT_COM_OSPF_RTYPE2: ND_PRINT((ndo, ": area:%s, router-type:%s, metric-type:%s%s", ipaddr_string(ndo, tptr+2), tok2str(bgp_extd_comm_ospf_rtype_values, "unknown (0x%02x)", *(tptr+6)), (*(tptr+7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "", ((*(tptr+6) == BGP_OSPF_RTYPE_EXT) || (*(tptr+6) == BGP_OSPF_RTYPE_NSSA)) ? "E1" : "")); break; case BGP_EXT_COM_L2INFO: ND_PRINT((ndo, ": %s Control Flags [0x%02x]:MTU %u", tok2str(l2vpn_encaps_values, "unknown encaps", *(tptr+2)), *(tptr+3), EXTRACT_16BITS(tptr+4))); break; case BGP_EXT_COM_SOURCE_AS: ND_PRINT((ndo, ": AS %u", EXTRACT_16BITS(tptr+2))); break; default: ND_TCHECK2(*tptr,8); print_unknown_data(ndo, tptr, "\n\t ", 8); break; } tlen -=8; tptr +=8; } break; case BGPTYPE_PMSI_TUNNEL: { uint8_t tunnel_type, flags; ND_TCHECK2(tptr[0], 5); tunnel_type = *(tptr+1); flags = *tptr; tlen = len; ND_PRINT((ndo, "\n\t Tunnel-type %s (%u), Flags [%s], MPLS Label %u", tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type), tunnel_type, bittok2str(bgp_pmsi_flag_values, "none", flags), EXTRACT_24BITS(tptr+2)>>4)); tptr +=5; tlen -= 5; switch (tunnel_type) { case BGP_PMSI_TUNNEL_PIM_SM: /* fall through */ case BGP_PMSI_TUNNEL_PIM_BIDIR: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Sender %s, P-Group %s", ipaddr_string(ndo, tptr), ipaddr_string(ndo, tptr+4))); break; case BGP_PMSI_TUNNEL_PIM_SSM: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Root-Node %s, P-Group %s", ipaddr_string(ndo, tptr), ipaddr_string(ndo, tptr+4))); break; case BGP_PMSI_TUNNEL_INGRESS: ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "\n\t Tunnel-Endpoint %s", ipaddr_string(ndo, tptr))); break; case BGP_PMSI_TUNNEL_LDP_P2MP: /* fall through */ case BGP_PMSI_TUNNEL_LDP_MP2MP: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Root-Node %s, LSP-ID 0x%08x", ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr+4))); break; case BGP_PMSI_TUNNEL_RSVP_P2MP: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x", ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr+4))); break; default: if (ndo->ndo_vflag <= 1) { print_unknown_data(ndo, tptr, "\n\t ", tlen); } } break; } case BGPTYPE_AIGP: { uint8_t type; uint16_t length; tlen = len; while (tlen >= 3) { ND_TCHECK2(tptr[0], 3); type = *tptr; length = EXTRACT_16BITS(tptr+1); tptr += 3; tlen -= 3; ND_PRINT((ndo, "\n\t %s TLV (%u), length %u", tok2str(bgp_aigp_values, "Unknown", type), type, length)); if (length < 3) goto trunc; length -= 3; /* * Check if we can read the TLV data. */ ND_TCHECK2(tptr[3], length); switch (type) { case BGP_AIGP_TLV: if (length < 8) goto trunc; ND_PRINT((ndo, ", metric %" PRIu64, EXTRACT_64BITS(tptr))); break; default: if (ndo->ndo_vflag <= 1) { print_unknown_data(ndo, tptr,"\n\t ", length); } } tptr += length; tlen -= length; } break; } case BGPTYPE_ATTR_SET: ND_TCHECK2(tptr[0], 4); if (len < 4) goto trunc; ND_PRINT((ndo, "\n\t Origin AS: %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)))); tptr+=4; len -=4; while (len) { u_int aflags, alenlen, alen; ND_TCHECK2(tptr[0], 2); if (len < 2) goto trunc; aflags = *tptr; atype = *(tptr + 1); tptr += 2; len -= 2; alenlen = bgp_attr_lenlen(aflags, tptr); ND_TCHECK2(tptr[0], alenlen); if (len < alenlen) goto trunc; alen = bgp_attr_len(aflags, tptr); tptr += alenlen; len -= alenlen; ND_PRINT((ndo, "\n\t %s (%u), length: %u", tok2str(bgp_attr_values, "Unknown Attribute", atype), atype, alen)); if (aflags) { ND_PRINT((ndo, ", Flags [%s%s%s%s", aflags & 0x80 ? "O" : "", aflags & 0x40 ? "T" : "", aflags & 0x20 ? "P" : "", aflags & 0x10 ? "E" : "")); if (aflags & 0xf) ND_PRINT((ndo, "+%x", aflags & 0xf)); ND_PRINT((ndo, "]: ")); } /* FIXME check for recursion */ if (!bgp_attr_print(ndo, atype, tptr, alen)) return 0; tptr += alen; len -= alen; } break; case BGPTYPE_LARGE_COMMUNITY: if (len == 0 || len % 12) { ND_PRINT((ndo, "invalid len")); break; } ND_PRINT((ndo, "\n\t ")); while (len > 0) { ND_TCHECK2(*tptr, 12); ND_PRINT((ndo, "%u:%u:%u%s", EXTRACT_32BITS(tptr), EXTRACT_32BITS(tptr + 4), EXTRACT_32BITS(tptr + 8), (len > 12) ? ", " : "")); tptr += 12; len -= 12; } break; default: ND_TCHECK2(*pptr,len); ND_PRINT((ndo, "\n\t no Attribute %u decoder", atype)); /* we have no decoder for the attribute */ if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, pptr, "\n\t ", len); break; } if (ndo->ndo_vflag > 1 && len) { /* omit zero length attributes*/ ND_TCHECK2(*pptr,len); print_unknown_data(ndo, pptr, "\n\t ", len); } return 1; trunc: return 0; }
5,151
68,017
0
static MagickBooleanType ReadPSDChannelZip(Image *image,const size_t channels, const ssize_t type,const PSDCompressionType compression, const size_t compact_size,ExceptionInfo *exception) { MagickBooleanType status; register unsigned char *p; size_t count, length, packet_size, row_size; ssize_t y; unsigned char *compact_pixels, *pixels; z_stream stream; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " layer data is ZIP compressed"); compact_pixels=(unsigned char *) AcquireQuantumMemory(compact_size, sizeof(*compact_pixels)); if (compact_pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); packet_size=GetPSDPacketSize(image); row_size=image->columns*packet_size; count=image->rows*row_size; pixels=(unsigned char *) AcquireQuantumMemory(count,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) { compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); } ResetMagickMemory(&stream,0,sizeof(stream)); stream.data_type=Z_BINARY; (void) ReadBlob(image,compact_size,compact_pixels); stream.next_in=(Bytef *)compact_pixels; stream.avail_in=(uInt) compact_size; stream.next_out=(Bytef *)pixels; stream.avail_out=(uInt) count; if (inflateInit(&stream) == Z_OK) { int ret; while (stream.avail_out > 0) { ret=inflate(&stream, Z_SYNC_FLUSH); if ((ret != Z_OK) && (ret != Z_STREAM_END)) { compact_pixels=(unsigned char *) RelinquishMagickMemory( compact_pixels); pixels=(unsigned char *) RelinquishMagickMemory(pixels); return(MagickFalse); } } } if (compression == ZipWithPrediction) { p=pixels; while (count > 0) { length=image->columns; while (--length) { if (packet_size == 2) { p[2]+=p[0]+((p[1]+p[3]) >> 8); p[3]+=p[1]; } else *(p+1)+=*p; p+=packet_size; } p+=packet_size; count-=row_size; } } status=MagickTrue; p=pixels; for (y=0; y < (ssize_t) image->rows; y++) { status=ReadPSDChannelPixels(image,channels,y,type,p,exception); if (status == MagickFalse) break; p+=row_size; } compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); pixels=(unsigned char *) RelinquishMagickMemory(pixels); return(status); }
5,152
12,193
0
void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, DisplaySurface *surface) { SimpleSpiceUpdate *update; bool need_destroy; dprint(1, "%s/%d:\n", __func__, ssd->qxl.id); memset(&ssd->dirty, 0, sizeof(ssd->dirty)); if (ssd->surface) { pixman_image_unref(ssd->surface); ssd->surface = NULL; pixman_image_unref(ssd->mirror); ssd->mirror = NULL; } qemu_mutex_lock(&ssd->lock); need_destroy = (ssd->ds != NULL); ssd->ds = surface; while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) { QTAILQ_REMOVE(&ssd->updates, update, next); qemu_spice_destroy_update(ssd, update); } qemu_mutex_unlock(&ssd->lock); if (need_destroy) { qemu_spice_destroy_host_primary(ssd); } if (ssd->ds) { qemu_spice_create_host_primary(ssd); } memset(&ssd->dirty, 0, sizeof(ssd->dirty)); ssd->notify++; }
5,153
8,543
0
static void ssh2_pkt_defer_noqueue(Ssh ssh, struct Packet *pkt, int noignore) { int len; if (ssh->cscipher != NULL && (ssh->cscipher->flags & SSH_CIPHER_IS_CBC) && ssh->deferred_len == 0 && !noignore && !(ssh->remote_bugs & BUG_CHOKES_ON_SSH2_IGNORE)) { /* * Interpose an SSH_MSG_IGNORE to ensure that user data don't * get encrypted with a known IV. */ struct Packet *ipkt = ssh2_pkt_init(SSH2_MSG_IGNORE); ssh2_pkt_addstring_start(ipkt); ssh2_pkt_defer_noqueue(ssh, ipkt, TRUE); } len = ssh2_pkt_construct(ssh, pkt); if (ssh->deferred_len + len > ssh->deferred_size) { ssh->deferred_size = ssh->deferred_len + len + 128; ssh->deferred_send_data = sresize(ssh->deferred_send_data, ssh->deferred_size, unsigned char); } memcpy(ssh->deferred_send_data + ssh->deferred_len, pkt->body, len); ssh->deferred_len += len; ssh->deferred_data_size += pkt->encrypted_len; ssh_free_packet(pkt); }
5,154
67,912
0
int jas_stream_flush(jas_stream_t *stream) { if (stream->bufmode_ & JAS_STREAM_RDBUF) { return 0; } return jas_stream_flushbuf(stream, EOF); }
5,155
46,338
0
int gfs2_open_common(struct inode *inode, struct file *file) { struct gfs2_file *fp; int ret; if (S_ISREG(inode->i_mode)) { ret = generic_file_open(inode, file); if (ret) return ret; } fp = kzalloc(sizeof(struct gfs2_file), GFP_NOFS); if (!fp) return -ENOMEM; mutex_init(&fp->f_fl_mutex); gfs2_assert_warn(GFS2_SB(inode), !file->private_data); file->private_data = fp; return 0; }
5,156
71,769
0
static MagickBooleanType IsPFA(const unsigned char *magick,const size_t length) { if (length < 14) return(MagickFalse); if (LocaleNCompare((char *) magick,"%!PS-AdobeFont",14) == 0) return(MagickTrue); return(MagickFalse); }
5,157
178,748
1
static void _out_result(conn_t out, nad_t nad) { int attr; jid_t from, to; char *rkey; int rkeylen; attr = nad_find_attr(nad, 0, -1, "from", NULL); if(attr < 0 || (from = jid_new(NAD_AVAL(nad, attr), NAD_AVAL_L(nad, attr))) == NULL) { log_debug(ZONE, "missing or invalid from on db result packet"); nad_free(nad); return; } attr = nad_find_attr(nad, 0, -1, "to", NULL); if(attr < 0 || (to = jid_new(NAD_AVAL(nad, attr), NAD_AVAL_L(nad, attr))) == NULL) { log_debug(ZONE, "missing or invalid to on db result packet"); jid_free(from); nad_free(nad); return; } rkey = s2s_route_key(NULL, to->domain, from->domain); rkeylen = strlen(rkey); /* key is valid */ if(nad_find_attr(nad, 0, -1, "type", "valid") >= 0) { log_write(out->s2s->log, LOG_NOTICE, "[%d] [%s, port=%d] outgoing route '%s' is now valid%s%s", out->fd->fd, out->ip, out->port, rkey, (out->s->flags & SX_SSL_WRAPPER) ? ", TLS negotiated" : "", out->s->compressed ? ", ZLIB compression enabled" : ""); xhash_put(out->states, pstrdup(xhash_pool(out->states), rkey), (void *) conn_VALID); /* !!! small leak here */ log_debug(ZONE, "%s valid, flushing queue", rkey); /* flush the queue */ out_flush_route_queue(out->s2s, rkey, rkeylen); free(rkey); jid_free(from); jid_free(to); nad_free(nad); return; } /* invalid */ log_write(out->s2s->log, LOG_NOTICE, "[%d] [%s, port=%d] outgoing route '%s' is now invalid", out->fd->fd, out->ip, out->port, rkey); /* close connection */ log_write(out->s2s->log, LOG_NOTICE, "[%d] [%s, port=%d] closing connection", out->fd->fd, out->ip, out->port); /* report stream error */ sx_error(out->s, stream_err_INVALID_ID, "dialback negotiation failed"); /* close the stream */ sx_close(out->s); /* bounce queue */ out_bounce_route_queue(out->s2s, rkey, rkeylen, stanza_err_SERVICE_UNAVAILABLE); free(rkey); jid_free(from); jid_free(to); nad_free(nad); }
5,158
137,972
0
AccessibilityRole AXLayoutObject::nativeAccessibilityRoleIgnoringAria() const { Node* node = m_layoutObject->node(); LayoutBoxModelObject* cssBox = getLayoutBoxModelObject(); if ((cssBox && cssBox->isListItem()) || isHTMLLIElement(node)) return ListItemRole; if (m_layoutObject->isListMarker()) return ListMarkerRole; if (m_layoutObject->isBR()) return LineBreakRole; if (m_layoutObject->isText()) return StaticTextRole; if (cssBox && isImageOrAltText(cssBox, node)) { if (node && node->isLink()) return ImageMapRole; if (isHTMLInputElement(node)) return ariaHasPopup() ? PopUpButtonRole : ButtonRole; if (isSVGImage()) return SVGRootRole; return ImageRole; } if (isHTMLCanvasElement(node) && m_layoutObject->isCanvas()) return CanvasRole; if (cssBox && cssBox->isLayoutView()) return WebAreaRole; if (m_layoutObject->isSVGImage()) return ImageRole; if (m_layoutObject->isSVGRoot()) return SVGRootRole; if (m_layoutObject->isTableSection()) return IgnoredRole; if (m_layoutObject->isHR()) return SplitterRole; return AXNodeObject::nativeAccessibilityRoleIgnoringAria(); }
5,159
116,573
0
virtual skia::PlatformCanvas* GetDrawingCanvas(TransportDIB** memory, const gfx::Rect& rect) { return NULL; }
5,160
165,828
0
SVGElementSet* SVGElement::SetOfIncomingReferences() const { if (!HasSVGRareData()) return nullptr; return &SvgRareData()->IncomingReferences(); }
5,161
70,559
0
static int l2tp_ip_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { struct inet_sock *inet = inet_sk(sk); size_t copied = 0; int err = -EOPNOTSUPP; DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); struct sk_buff *skb; if (flags & MSG_OOB) goto out; skb = skb_recv_datagram(sk, flags, noblock, &err); if (!skb) goto out; copied = skb->len; if (len < copied) { msg->msg_flags |= MSG_TRUNC; copied = len; } err = skb_copy_datagram_msg(skb, 0, msg, copied); if (err) goto done; sock_recv_timestamp(msg, sk, skb); /* Copy the address. */ if (sin) { sin->sin_family = AF_INET; sin->sin_addr.s_addr = ip_hdr(skb)->saddr; sin->sin_port = 0; memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); *addr_len = sizeof(*sin); } if (inet->cmsg_flags) ip_cmsg_recv(msg, skb); if (flags & MSG_TRUNC) copied = skb->len; done: skb_free_datagram(sk, skb); out: return err ? err : copied; }
5,162
114,154
0
int TestOpenInputDesktop() { bool is_interactive = false; if (IsInteractiveDesktop(&is_interactive) && is_interactive) { return SBOX_TEST_SUCCEEDED; } HDESK desk = ::OpenInputDesktop(0, FALSE, DESKTOP_CREATEWINDOW); if (desk) { ::CloseDesktop(desk); return SBOX_TEST_SUCCEEDED; } return SBOX_TEST_DENIED; }
5,163
8,413
0
pvscsi_hot_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { PVSCSIState *s = PVSCSI(hotplug_dev); pvscsi_send_msg(s, SCSI_DEVICE(dev), PVSCSI_MSG_DEV_REMOVED); qdev_simple_device_unplug_cb(hotplug_dev, dev, errp); }
5,164
96,855
0
static int fifo_open(struct inode *inode, struct file *filp) { struct pipe_inode_info *pipe; bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC; int ret; filp->f_version = 0; spin_lock(&inode->i_lock); if (inode->i_pipe) { pipe = inode->i_pipe; pipe->files++; spin_unlock(&inode->i_lock); } else { spin_unlock(&inode->i_lock); pipe = alloc_pipe_info(); if (!pipe) return -ENOMEM; pipe->files = 1; spin_lock(&inode->i_lock); if (unlikely(inode->i_pipe)) { inode->i_pipe->files++; spin_unlock(&inode->i_lock); free_pipe_info(pipe); pipe = inode->i_pipe; } else { inode->i_pipe = pipe; spin_unlock(&inode->i_lock); } } filp->private_data = pipe; /* OK, we have a pipe and it's pinned down */ __pipe_lock(pipe); /* We can only do regular read/write on fifos */ filp->f_mode &= (FMODE_READ | FMODE_WRITE); switch (filp->f_mode) { case FMODE_READ: /* * O_RDONLY * POSIX.1 says that O_NONBLOCK means return with the FIFO * opened, even when there is no process writing the FIFO. */ pipe->r_counter++; if (pipe->readers++ == 0) wake_up_partner(pipe); if (!is_pipe && !pipe->writers) { if ((filp->f_flags & O_NONBLOCK)) { /* suppress EPOLLHUP until we have * seen a writer */ filp->f_version = pipe->w_counter; } else { if (wait_for_partner(pipe, &pipe->w_counter)) goto err_rd; } } break; case FMODE_WRITE: /* * O_WRONLY * POSIX.1 says that O_NONBLOCK means return -1 with * errno=ENXIO when there is no process reading the FIFO. */ ret = -ENXIO; if (!is_pipe && (filp->f_flags & O_NONBLOCK) && !pipe->readers) goto err; pipe->w_counter++; if (!pipe->writers++) wake_up_partner(pipe); if (!is_pipe && !pipe->readers) { if (wait_for_partner(pipe, &pipe->r_counter)) goto err_wr; } break; case FMODE_READ | FMODE_WRITE: /* * O_RDWR * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. * This implementation will NEVER block on a O_RDWR open, since * the process can at least talk to itself. */ pipe->readers++; pipe->writers++; pipe->r_counter++; pipe->w_counter++; if (pipe->readers == 1 || pipe->writers == 1) wake_up_partner(pipe); break; default: ret = -EINVAL; goto err; } /* Ok! */ __pipe_unlock(pipe); return 0; err_rd: if (!--pipe->readers) wake_up_interruptible(&pipe->wait); ret = -ERESTARTSYS; goto err; err_wr: if (!--pipe->writers) wake_up_interruptible(&pipe->wait); ret = -ERESTARTSYS; goto err; err: __pipe_unlock(pipe); put_pipe_info(inode, pipe); return ret; }
5,165
64,615
0
lexer_hex_to_character (parser_context_t *context_p, /**< context */ const uint8_t *source_p, /**< current source position */ int length) /**< source length */ { uint32_t result = 0; do { uint32_t byte = *source_p++; result <<= 4; if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9) { result += byte - LIT_CHAR_0; } else { byte = LEXER_TO_ASCII_LOWERCASE (byte); if (byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F) { result += byte - (LIT_CHAR_LOWERCASE_A - 10); } else { parser_raise_error (context_p, PARSER_ERR_INVALID_ESCAPE_SEQUENCE); } } } while (--length > 0); return (ecma_char_t) result; } /* lexer_hex_to_character */
5,166
137,600
0
static void LaunchDownloadOverwriteInfoBar( JNIEnv* env, const JavaParamRef<jclass>& clazz, const JavaParamRef<jobject>& delegate, const JavaParamRef<jobject>& tab, const JavaParamRef<jobject>& download_info, const JavaParamRef<jstring>& jfile_name, const JavaParamRef<jstring>& jdir_name, const JavaParamRef<jstring>& jdir_full_path) { TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); std::string file_name = base::android::ConvertJavaStringToUTF8(env, jfile_name); std::string dir_name = base::android::ConvertJavaStringToUTF8(env, jdir_name); std::string dir_full_path = base::android::ConvertJavaStringToUTF8(env, jdir_full_path); chrome::android::AndroidDownloadManagerOverwriteInfoBarDelegate::Create( InfoBarService::FromWebContents(tab_android->web_contents()), file_name, dir_name, dir_full_path, delegate, download_info); }
5,167
176,438
0
WORD32 ih264d_ctl(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) { ivd_ctl_set_config_ip_t *ps_ctl_ip; ivd_ctl_set_config_op_t *ps_ctl_op; WORD32 ret = IV_SUCCESS; UWORD32 subcommand; dec_struct_t *ps_dec = dec_hdl->pv_codec_handle; if(ps_dec->init_done != 1) { return IV_FAIL; } ps_ctl_ip = (ivd_ctl_set_config_ip_t*)pv_api_ip; ps_ctl_op = (ivd_ctl_set_config_op_t*)pv_api_op; ps_ctl_op->u4_error_code = 0; subcommand = ps_ctl_ip->e_sub_cmd; switch(subcommand) { case IVD_CMD_CTL_GETPARAMS: ret = ih264d_get_status(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_SETPARAMS: ret = ih264d_set_params(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_RESET: ret = ih264d_reset(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_SETDEFAULT: ret = ih264d_set_default_params(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_FLUSH: ret = ih264d_set_flush_mode(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_GETBUFINFO: ret = ih264d_get_buf_info(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_CTL_GETVERSION: ret = ih264d_get_version(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IH264D_CMD_CTL_DEGRADE: ret = ih264d_set_degrade(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IH264D_CMD_CTL_SET_NUM_CORES: ret = ih264d_set_num_cores(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS: ret = ih264d_get_frame_dimensions(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IH264D_CMD_CTL_GET_VUI_PARAMS: ret = ih264d_get_vui_params(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; case IH264D_CMD_CTL_SET_PROCESSOR: ret = ih264d_set_processor(dec_hdl, (void *)pv_api_ip, (void *)pv_api_op); break; default: H264_DEC_DEBUG_PRINT("\ndo nothing\n") ; break; } return ret; }
5,168
29,291
0
static void ip_vs_trash_cleanup(void) { struct ip_vs_dest *dest, *nxt; list_for_each_entry_safe(dest, nxt, &ip_vs_dest_trash, n_list) { list_del(&dest->n_list); ip_vs_dst_reset(dest); __ip_vs_unbind_svc(dest); kfree(dest); } }
5,169
133,560
0
void WebContentsImpl::FocusThroughTabTraversal(bool reverse) { if (ShowingInterstitialPage()) { GetRenderManager()->interstitial_page()->FocusThroughTabTraversal(reverse); return; } GetRenderViewHostImpl()->SetInitialFocus(reverse); }
5,170
106
0
PHP_FUNCTION(openssl_csr_export_to_file) { X509_REQ * csr; zval * zcsr = NULL; zend_bool notext = 1; char * filename = NULL; int filename_len; BIO * bio_out; long csr_resource; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &zcsr, &filename, &filename_len, &notext) == FAILURE) { return; } RETVAL_FALSE; if (strlen(filename) != filename_len) { return; } csr = php_openssl_csr_from_zval(&zcsr, 0, &csr_resource TSRMLS_CC); if (csr == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get CSR from parameter 1"); return; } if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { return; } bio_out = BIO_new_file(filename, "w"); if (bio_out) { if (!notext) { X509_REQ_print(bio_out, csr); } PEM_write_bio_X509_REQ(bio_out, csr); RETVAL_TRUE; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening file %s", filename); } if (csr_resource == -1 && csr) { X509_REQ_free(csr); } BIO_free(bio_out); }
5,171
72,311
0
sshkey_load_public_rsa1(int fd, struct sshkey **keyp, char **commentp) { struct sshbuf *b = NULL; int r; if (keyp != NULL) *keyp = NULL; if (commentp != NULL) *commentp = NULL; if ((b = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = sshkey_load_file(fd, b)) != 0) goto out; if ((r = sshkey_parse_public_rsa1_fileblob(b, keyp, commentp)) != 0) goto out; r = 0; out: sshbuf_free(b); return r; }
5,172
49,338
0
static int fwnet_open(struct net_device *net) { struct fwnet_device *dev = netdev_priv(net); int ret; ret = fwnet_broadcast_start(dev); if (ret) return ret; netif_start_queue(net); spin_lock_irq(&dev->lock); set_carrier_state(dev); spin_unlock_irq(&dev->lock); return 0; }
5,173
27,568
0
static int opl3_load_patch(int dev, int format, const char __user *addr, int count, int pmgr_flag) { struct sbi_instrument ins; if (count <sizeof(ins)) { printk(KERN_WARNING "FM Error: Patch record too short\n"); return -EINVAL; } if (copy_from_user(&ins, addr, sizeof(ins))) return -EFAULT; if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) { printk(KERN_WARNING "FM Error: Invalid instrument number %d\n", ins.channel); return -EINVAL; } ins.key = format; return store_instr(ins.channel, &ins); }
5,174
45,901
0
static int __init seqiv_module_init(void) { return crypto_register_template(&seqiv_tmpl); }
5,175
89,092
0
void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) { if (!insn || !regs) return (void __user *)-1L; switch (insn->addr_bytes) { case 2: return get_addr_ref_16(insn, regs); case 4: return get_addr_ref_32(insn, regs); case 8: return get_addr_ref_64(insn, regs); default: return (void __user *)-1L; } }
5,176
41,593
0
static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); struct sk_buff *skb; size_t copied; int err; skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &err); if (!skb) return err; skb_reset_transport_header(skb); copied = skb->len; if (copied > size) { pr_debug("%s(), Received truncated frame (%zd < %zd)!\n", __func__, copied, size); copied = size; msg->msg_flags |= MSG_TRUNC; } skb_copy_datagram_msg(skb, 0, msg, copied); skb_free_datagram(sk, skb); /* * Check if we have previously stopped IrTTP and we know * have more free space in our rx_queue. If so tell IrTTP * to start delivering frames again before our rx_queue gets * empty */ if (self->rx_flow == FLOW_STOP) { if ((atomic_read(&sk->sk_rmem_alloc) << 2) <= sk->sk_rcvbuf) { pr_debug("%s(), Starting IrTTP\n", __func__); self->rx_flow = FLOW_START; irttp_flow_request(self->tsap, FLOW_START); } } return copied; }
5,177
110,909
0
ui::TouchStatus RootWindow::ProcessTouchEvent(Window* target, TouchEvent* event) { if (!target->IsVisible()) return ui::TOUCH_STATUS_UNKNOWN; EventFilters filters; if (target == this) GetEventFiltersToNotify(target, &filters); else GetEventFiltersToNotify(target->parent(), &filters); for (EventFilters::const_reverse_iterator it = filters.rbegin(), rend = filters.rend(); it != rend; ++it) { ui::TouchStatus status = (*it)->PreHandleTouchEvent(target, event); if (status != ui::TOUCH_STATUS_UNKNOWN) return status; } if (target->delegate()) return target->delegate()->OnTouchEvent(event); return ui::TOUCH_STATUS_UNKNOWN; }
5,178
124,225
0
void LoginPromptBrowserTestObserver::Register( const content::NotificationSource& source) { registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); }
5,179
40,791
0
static int x25_release(struct socket *sock) { struct sock *sk = sock->sk; struct x25_sock *x25; if (!sk) return 0; x25 = x25_sk(sk); sock_hold(sk); lock_sock(sk); switch (x25->state) { case X25_STATE_0: case X25_STATE_2: x25_disconnect(sk, 0, 0, 0); __x25_destroy_socket(sk); goto out; case X25_STATE_1: case X25_STATE_3: case X25_STATE_4: x25_clear_queues(sk); x25_write_internal(sk, X25_CLEAR_REQUEST); x25_start_t23timer(sk); x25->state = X25_STATE_2; sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); sock_set_flag(sk, SOCK_DEAD); sock_set_flag(sk, SOCK_DESTROY); break; } sock_orphan(sk); out: release_sock(sk); sock_put(sk); return 0; }
5,180
93,776
0
virDomainCreateLinux(virConnectPtr conn, const char *xmlDesc, unsigned int flags) { return virDomainCreateXML(conn, xmlDesc, flags); }
5,181
32,078
0
void __napi_schedule(struct napi_struct *n) { unsigned long flags; local_irq_save(flags); list_add_tail(&n->poll_list, &__get_cpu_var(softnet_data).poll_list); __raise_softirq_irqoff(NET_RX_SOFTIRQ); local_irq_restore(flags); }
5,182
53,273
0
char *xmlrpc_decode_string(char *buf) { const char *p; char *q; p = buf; q = buf; while (*p != '\0') { if (*p == '&') { p++; if (!strncmp(p, "gt;", 3)) *q++ = '>', p += 3; else if (!strncmp(p, "lt;", 3)) *q++ = '<', p += 3; else if (!strncmp(p, "quot;", 5)) *q++ = '"', p += 5; else if (!strncmp(p, "amp;", 4)) *q++ = '&', p += 4; else if (*p == '#') { p++; *q++ = (char)atoi(p); while (*p != ';' && *p != '\0') p++; } } else *q++ = *p++; } *q = '\0'; return buf; }
5,183
132,180
0
void RenderFrameImpl::BindServiceRegistry( mojo::InterfaceRequest<mojo::ServiceProvider> services, mojo::ServiceProviderPtr exposed_services) { service_registry_.Bind(services.Pass()); service_registry_.BindRemoteServiceProvider(exposed_services.Pass()); }
5,184
164,123
0
bool AppCacheDatabase::LazyUpdateLastAccessTime(int64_t group_id, base::Time time) { if (!LazyOpen(kCreateIfNeeded)) return false; lazy_last_access_times_[group_id] = time; return true; }
5,185
48,404
0
PredictorPrintDir(TIFF* tif, FILE* fd, long flags) { TIFFPredictorState* sp = PredictorState(tif); (void) flags; if (TIFFFieldSet(tif,FIELD_PREDICTOR)) { fprintf(fd, " Predictor: "); switch (sp->predictor) { case 1: fprintf(fd, "none "); break; case 2: fprintf(fd, "horizontal differencing "); break; case 3: fprintf(fd, "floating point predictor "); break; } fprintf(fd, "%u (0x%x)\n", sp->predictor, sp->predictor); } if (sp->printdir) (*sp->printdir)(tif, fd, flags); }
5,186
5,870
0
static uint64_t ahci_mem_read_32(void *opaque, hwaddr addr) { AHCIState *s = opaque; uint32_t val = 0; if (addr < AHCI_GENERIC_HOST_CONTROL_REGS_MAX_ADDR) { switch (addr) { case HOST_CAP: val = s->control_regs.cap; break; case HOST_CTL: val = s->control_regs.ghc; break; case HOST_IRQ_STAT: val = s->control_regs.irqstatus; break; case HOST_PORTS_IMPL: val = s->control_regs.impl; break; case HOST_VERSION: val = s->control_regs.version; break; } DPRINTF(-1, "(addr 0x%08X), val 0x%08X\n", (unsigned) addr, val); } else if ((addr >= AHCI_PORT_REGS_START_ADDR) && (addr < (AHCI_PORT_REGS_START_ADDR + (s->ports * AHCI_PORT_ADDR_OFFSET_LEN)))) { val = ahci_port_read(s, (addr - AHCI_PORT_REGS_START_ADDR) >> 7, addr & AHCI_PORT_ADDR_OFFSET_MASK); } return val; }
5,187
104,511
0
void CrosMock::TearDownMocks() { if (loader_) test_api()->SetLibraryLoader(NULL, false); if (mock_cryptohome_library_) test_api()->SetCryptohomeLibrary(NULL, false); if (mock_network_library_) test_api()->SetNetworkLibrary(NULL, false); if (mock_power_library_) test_api()->SetPowerLibrary(NULL, false); if (mock_screen_lock_library_) test_api()->SetScreenLockLibrary(NULL, false); if (mock_speech_synthesis_library_) test_api()->SetSpeechSynthesisLibrary(NULL, false); if (mock_touchpad_library_) test_api()->SetTouchpadLibrary(NULL, false); }
5,188
76,751
0
insertEmphasisSymbol(const EmphasisInfo *buffer, const int at, const EmphRuleNumber emphRule, const EmphasisClass class, const TranslationTableHeader *table, int pos, const InString *input, OutString *output, int *posMapping, int *cursorPosition, int *cursorStatus) { if (buffer[at].symbol & class) { const TranslationTableRule *indicRule; if (brailleIndicatorDefined( table->emphRules[emphRule][letterOffset], table, &indicRule)) for_updatePositions(&indicRule->charsdots[0], 0, indicRule->dotslen, 0, pos, input, output, posMapping, cursorPosition, cursorStatus); } }
5,189
167,727
0
void WebRuntimeFeatures::EnableMergeBlockingNonBlockingPools(bool enable) { RuntimeEnabledFeatures::SetMergeBlockingNonBlockingPoolsEnabled(enable); }
5,190
152,572
0
int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { static struct ModifierMap { MockKeyboard::Modifiers src; int dst; } kModifierMap[] = { { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, { MockKeyboard::RIGHT_SHIFT, ui::EF_SHIFT_DOWN }, { MockKeyboard::LEFT_CONTROL, ui::EF_CONTROL_DOWN }, { MockKeyboard::RIGHT_CONTROL, ui::EF_CONTROL_DOWN }, { MockKeyboard::LEFT_ALT, ui::EF_ALT_DOWN }, { MockKeyboard::RIGHT_ALT, ui::EF_ALT_DOWN }, }; int flags = 0; for (size_t i = 0; i < base::size(kModifierMap); ++i) { if (kModifierMap[i].src & modifiers) { flags |= kModifierMap[i].dst; } } return flags; }
5,191
48,867
0
void netdev_change_features(struct net_device *dev) { __netdev_update_features(dev); netdev_features_change(dev); }
5,192
101,918
0
~GtkPrinterList() { for (std::vector<GtkPrinter*>::iterator it = printers_.begin(); it < printers_.end(); ++it) { g_object_unref(*it); } }
5,193
149,560
0
bool HostFound(const std::string& host) { return base::Contains(successful_dns_lookups_, host); }
5,194
90,464
0
static void ib_uverbs_release_async_event_file(struct kref *ref) { struct ib_uverbs_async_event_file *file = container_of(ref, struct ib_uverbs_async_event_file, ref); kfree(file); }
5,195
187,014
1
void NavigationRequest::OnRequestRedirected( const net::RedirectInfo& redirect_info, const scoped_refptr<network::ResourceResponse>& response) { response_ = response; ssl_info_ = response->head.ssl_info; #if defined(OS_ANDROID) base::WeakPtr<NavigationRequest> this_ptr(weak_factory_.GetWeakPtr()); bool should_override_url_loading = false; if (!GetContentClient()->browser()->ShouldOverrideUrlLoading( frame_tree_node_->frame_tree_node_id(), browser_initiated_, redirect_info.new_url, redirect_info.new_method, // Redirects are always not counted as from user gesture. false, true, frame_tree_node_->IsMainFrame(), common_params_.transition, &should_override_url_loading)) { // A Java exception was thrown by the embedding application; we // need to return from this task. Specifically, it's not safe from // this point on to make any JNI calls. return; } // The content/ embedder might cause |this| to be deleted while // |ShouldOverrideUrlLoading| is called. // See https://crbug.com/770157. if (!this_ptr) return; if (should_override_url_loading) { navigation_handle_->set_net_error_code(net::ERR_ABORTED); common_params_.url = redirect_info.new_url; common_params_.method = redirect_info.new_method; // Update the navigation handle to point to the new url to ensure // AwWebContents sees the new URL and thus passes that URL to onPageFinished // (rather than passing the old URL). navigation_handle_->UpdateStateFollowingRedirect( GURL(redirect_info.new_referrer), base::Bind(&NavigationRequest::OnRedirectChecksComplete, base::Unretained(this))); frame_tree_node_->ResetNavigationRequest(false, true); return; } #endif if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRedirectToURL( redirect_info.new_url)) { DVLOG(1) << "Denied redirect for " << redirect_info.new_url.possibly_invalid_spec(); navigation_handle_->set_net_error_code(net::ERR_UNSAFE_REDIRECT); frame_tree_node_->ResetNavigationRequest(false, true); return; } // For renderer-initiated navigations we need to check if the source has // access to the URL. Browser-initiated navigations only rely on the // |CanRedirectToURL| test above. if (!browser_initiated_ && source_site_instance() && !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( source_site_instance()->GetProcess()->GetID(), redirect_info.new_url)) { DVLOG(1) << "Denied unauthorized redirect for " << redirect_info.new_url.possibly_invalid_spec(); navigation_handle_->set_net_error_code(net::ERR_UNSAFE_REDIRECT); frame_tree_node_->ResetNavigationRequest(false, true); return; } // For now, DevTools needs the POST data sent to the renderer process even if // it is no longer a POST after the redirect. if (redirect_info.new_method != "POST") common_params_.post_data = nullptr; // Mark time for the Navigation Timing API. if (commit_params_.navigation_timing.redirect_start.is_null()) { commit_params_.navigation_timing.redirect_start = commit_params_.navigation_timing.fetch_start; } commit_params_.navigation_timing.redirect_end = base::TimeTicks::Now(); commit_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); commit_params_.redirect_response.push_back(response->head); commit_params_.redirect_infos.push_back(redirect_info); // On redirects, the initial origin_to_commit is no longer correct, so it // must be cleared to avoid sending incorrect value to the renderer process. if (commit_params_.origin_to_commit) commit_params_.origin_to_commit.reset(); commit_params_.redirects.push_back(common_params_.url); common_params_.url = redirect_info.new_url; common_params_.method = redirect_info.new_method; common_params_.referrer.url = GURL(redirect_info.new_referrer); common_params_.referrer = Referrer::SanitizeForRequest(common_params_.url, common_params_.referrer); // Check Content Security Policy before the NavigationThrottles run. This // gives CSP a chance to modify requests that NavigationThrottles would // otherwise block. net::Error net_error = CheckContentSecurityPolicy(true /* has_followed_redirect */, redirect_info.insecure_scheme_was_upgraded, false /* is_response_check */); if (net_error != net::OK) { OnRequestFailedInternal( network::URLLoaderCompletionStatus(net_error), false /*skip_throttles*/, base::nullopt /*error_page_content*/, false /*collapse_frame*/); // DO NOT ADD CODE after this. The previous call to OnRequestFailedInternal // has destroyed the NavigationRequest. return; } if (CheckCredentialedSubresource() == CredentialedSubresourceCheckResult::BLOCK_REQUEST || CheckLegacyProtocolInSubresource() == LegacyProtocolInSubresourceCheckResult::BLOCK_REQUEST) { OnRequestFailedInternal( network::URLLoaderCompletionStatus(net::ERR_ABORTED), false /*skip_throttles*/, base::nullopt /*error_page_content*/, false /*collapse_frame*/); // DO NOT ADD CODE after this. The previous call to OnRequestFailedInternal // has destroyed the NavigationRequest. return; } // Compute the SiteInstance to use for the redirect and pass its // RenderProcessHost if it has a process. Keep a reference if it has a // process, so that the SiteInstance and its associated process aren't deleted // before the navigation is ready to commit. scoped_refptr<SiteInstance> site_instance = frame_tree_node_->render_manager()->GetSiteInstanceForNavigationRequest( *this); speculative_site_instance_ = site_instance->HasProcess() ? site_instance : nullptr; // If the new site instance doesn't yet have a process, then tell the // SpareRenderProcessHostManager so it can decide whether to start warming up // the spare at this time (note that the actual behavior depends on // RenderProcessHostImpl::IsSpareProcessKeptAtAllTimes). if (!site_instance->HasProcess()) { RenderProcessHostImpl::NotifySpareManagerAboutRecentlyUsedBrowserContext( site_instance->GetBrowserContext()); } // Re-evaluate the PreviewsState, but do not update the URLLoader. The // URLLoader PreviewsState is considered immutable after the URLLoader is // created. common_params_.previews_state = GetContentClient()->browser()->DetermineAllowedPreviews( common_params_.previews_state, navigation_handle_.get(), common_params_.url); // Check what the process of the SiteInstance is. It will be passed to the // NavigationHandle, and informed to expect a navigation to the redirected // URL. // Note: calling GetProcess on the SiteInstance can lead to the creation of a // new process if it doesn't have one. In this case, it should only be called // on a SiteInstance that already has a process. RenderProcessHost* expected_process = site_instance->HasProcess() ? site_instance->GetProcess() : nullptr; // It's safe to use base::Unretained because this NavigationRequest owns the // NavigationHandle where the callback will be stored. navigation_handle_->WillRedirectRequest( common_params_.referrer.url, expected_process, base::Bind(&NavigationRequest::OnRedirectChecksComplete, base::Unretained(this))); }
5,196
83,889
0
vips_foreign_find_load_buffer( const void *data, size_t size ) { VipsForeignLoadClass *load_class; if( !(load_class = (VipsForeignLoadClass *) vips_foreign_map( "VipsForeignLoad", (VipsSListMap2Fn) vips_foreign_find_load_buffer_sub, &data, &size )) ) { vips_error( "VipsForeignLoad", "%s", _( "buffer is not in a known format" ) ); return( NULL ); } return( G_OBJECT_CLASS_NAME( load_class ) ); }
5,197
20,225
0
static void hugetlbfs_i_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); }
5,198
108,779
0
ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() { return ChildProcessSecurityPolicyImpl::GetInstance(); }
5,199