Displaying 20 results from an estimated 22 matches for "new_array".
2023 Jun 25
0
[PATCH 08/26] virtio-mem: use array_size
...b66..a4dfe7aab288 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -399,7 +399,7 @@ static int virtio_mem_bbm_bb_states_prepare_next_bb(struct virtio_mem *vm)
> if (vm->bbm.bb_states && old_pages == new_pages)
> return 0;
>
> - new_array = vzalloc(new_pages * PAGE_SIZE);
> + new_array = vzalloc(array_size(new_pages, PAGE_SIZE));
> if (!new_array)
> return -ENOMEM;
>
> @@ -465,7 +465,7 @@ static int virtio_mem_sbm_mb_states_prepare_next_mb(struct virtio_mem *vm)
> if (vm->sbm.mb_states && old_page...
2007 Apr 18
2
Checking validity of NHS numbers
Hello
I need to check that the NHS numbers in my database are valid. I''m
storing them as ten-digit strings: the first nine are the identifier and
the tenth is a check digit.
There are four steps to calculating the check digit (from
http://www.connectingforhealth.nhs.uk/systemsandservices/nsts/docs/tech_nn_check_digit.pdf):
1. multiply each of the first nine digits by a weighting factor
2019 May 24
0
[PATCH] VMCI: Fix integer overflow in VMCI handle arrays
...ptr,
- struct vmci_handle handle)
+int vmci_handle_arr_append_entry(struct vmci_handle_arr **array_ptr,
+ struct vmci_handle handle)
{
struct vmci_handle_arr *array = *array_ptr;
if (unlikely(array->size >= array->capacity)) {
/* reallocate. */
struct vmci_handle_arr *new_array;
- size_t new_capacity = array->capacity * VMCI_ARR_CAP_MULT;
- size_t new_size = handle_arr_calc_size(new_capacity);
+ u32 capacity_bump = min(array->max_capacity - array->capacity,
+ array->capacity);
+ size_t new_size = handle_arr_calc_size(array->capacity +
+...
2006 Feb 20
1
Improved diagnostics patch
Hi, all --
Here's a small patch that gives better diagnostics on the daemon side if it
fails to start up due to inability to create or bind the socket.
Presently, it gives a log entry indicating that no sockets could be bound,
but crucially does *not* have the system error message (i.e. errno) from
the failed call, making it difficult or impossible to determine the
problem.
I do have a
2020 Feb 06
0
[PATCH] Add support for zstd compression
...it_done, flush_pending;
+ ZSTD_EndDirective flush = ZSTD_e_continue;
+ int32 n, r;
+
+ /* initialization */
+ if (!comp_init_done) {
+
+ zstd_cctx = ZSTD_createCCtx();
+ if (!zstd_cctx) {
+ rprintf(FERROR, "compression init failed\n");
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ obuf = new_array(char, MAX_DATA_COUNT + 2);
+ if (!obuf)
+ out_of_memory("send_deflated_token");
+
+ ZSTD_CCtx_setParameter(zstd_cctx, ZSTD_c_compressionLevel,
+ def_compress_level);
+ zstd_out_buff.dst = obuf + 2;
+
+ comp_init_done = 1;
+ }
+
+ if (last_token == -1) {
+ last_run_end = 0...
2004 Feb 06
4
memory reduction
...sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0;
- file_struct_len = idev_len? sizeof file[0] : min_file_struct_len;
+ file_struct_len = min_file_struct_len;
alloc_len = file_struct_len + dirname_len + basename_len
- + linkname_len + sum_len + idev_len;
- if (!(bp = new_array(char, alloc_len)))
- out_of_memory("receive_file_entry");
+ + linkname_len + sum_len;
+ bp = pool_alloc(flist->file_pool, alloc_len, "receive_file_entry");
+
file = *fptr = (struct file_struct *)bp;
memset(bp, 0, min_file_struct_len);
bp += file_struct_len;
@@ -634,...
2006 Jun 19
2
finding duplicates in an array
an application i am working on sends emails to an array of users. it is
possible for the user''s email to actually be in the array more than
once.
i don''t have a real strong grasp of the ruby syntax yet, but is there an
easy way to go through and either remove all of the duplicates or at
least only send an email to that user once?
--
Posted via http://www.ruby-forum.com/.
2017 Feb 07
2
[Bug 12568] New: Integer overflow still affects xattrs.c
...n = datum_len > MAX_FULL_DATUM ? 1 + MAX_DIGEST_LEN :
datum_len;
690 size_t extra_len = MIGHT_NEED_RPRE ? RPRE_LEN : 0;
691 if ((dget_len + extra_len < dget_len)
692 || (dget_len + extra_len + name_len < dget_len))
693 overflow_exit("receive_xattr");
694 ptr = new_array(char, dget_len + extra_len + name_len);
695 if (!ptr)
696 out_of_memory("receive_xattr");
697 name = ptr + dget_len + extra_len;
698 read_buf(f, name, name_len);
>From the code we can see that the security checks at line 691 and line 692 aim
to filter integer overflows...
2018 May 11
4
[Bug 13433] New: out_of_memory in receive_sums on large files
.../b.tc)
count=33554432 n=131072 rem=0
ERROR: out of memory in receive_sums [sender]
[sender] _exit_cleanup(code=22, file=util2.c, line=105): entered
rsync error: error allocating core memory buffers (code 22) at util2.c(105)
[sender=3.1.3]
This is getting called:
92 if (!(s->sums = new_array(struct sum_buf, s->count)))
93 out_of_memory("receive_sums");
And the size of a sum_buf(40 bytes) * the number of sums (33554432) exceeds
MALLOC_MAX.
How is this supposed to work/why is it breaking here, when I'm pretty sure I've
transferred files bigger...
2017 Oct 27
1
[Bug 13105] New: 1byte heap overflow in sanitize_path
...1 byte overwrite as the allocation of dest is too small.
sanitize_path (dest=0x0, p=0x60200000ebb0 "",
rootdir=0x4f51e0 "", depth=0, flags=1) at util.c:1009
1011 if (dest != p) {
1012 int plen = strlen(p); <-- returns 0
1023 } else if (!(dest = new_array(char, rlen + plen + 1))) <-- 1 byte
requested
1037 start = sanp = dest + rlen;
1073 if (sanp == dest) {
1074 /* ended up with nothing, so put in "." component */
1075 *sanp++ = '.';
1076 }
1077 *sanp = '\0'; <-- overwrite by 1
The...
2017 Oct 31
0
[Bug 13113] New: receive_xattr heap overflow when prepending RSYNC_PREFIX
...t;\0"};
code snippets are from xattrs.c
in receive_xattr a name is read from the sender. The name might need to be
prefixed depending on am_root. To make room for this prefix extra_len is
possibly allocated.
818 size_t extra_len = MIGHT_NEED_RPRE ? RPRE_LEN : 0;
822 ptr = new_array(char, dget_len + extra_len + name_len); <-- the
length values are received from the sender. In this case I'm sending dget_len =
0
61 #ifdef HAVE_LINUX_XATTRS
62 #define MIGHT_NEED_RPRE (am_root < 0)
The issue is that am_root < 0 isn't the only time that a prefix might be
prep...
2012 Oct 30
29
[PATCH 00/12] VMCI for Linux upstreaming
* * *
This series of VMCI linux upstreaming patches include latest udpate from
VMware.
-split guest, host and core driver code into different files
-use EXPORT_SYMBOLS_GPL
-remove vmci_device_get and vmci_device_release APIs
-simplify the event deliver mechanism
-driver ioctl code cleanup
-sparse clean
* * *
In an effort to improve the out-of-the-box experience with
2012 Oct 30
29
[PATCH 00/12] VMCI for Linux upstreaming
* * *
This series of VMCI linux upstreaming patches include latest udpate from
VMware.
-split guest, host and core driver code into different files
-use EXPORT_SYMBOLS_GPL
-remove vmci_device_get and vmci_device_release APIs
-simplify the event deliver mechanism
-driver ioctl code cleanup
-sparse clean
* * *
In an effort to improve the out-of-the-box experience with
2012 Jun 09
2
[patch] NFSv4/ZFS ACLs
This is a PoC patch for NFSv4/ZFS ACLs.
The objective of the patch is that rsync --acls support NFSv4/ZFS ACLs
without requiring a new command line option
NFSv4 ACLs can't be represented using POSIX draft ACLs, if an NFSv4 ACL is
present a separate POSIX draft ACL will not be present and there are new
APIs
to access NFSv4 ACLs. So we need to distinguish between NFSv4 ACLs and
POSIX
ACLs in
2004 Jun 17
1
[PATCH] make write_batch local
...send_sums(struct map_struct *buf, size_t len, int f_out,
! int flist_idx)
{
! size_t i, j;
struct sum_struct sum;
OFF_T offset = 0;
sum_sizes_sqroot(&sum, len);
write_sum_head(f_out, &sum);
+ if (write_batch) { /* save all the sums to write out */
+ sum.sums = new_array(struct sum_buf, sum.count);
+ if (!sum.sums) out_of_memory("generate_and_send_sums");
+ }
for (i = 0; i < sum.count; i++) {
unsigned int n1 = MIN(len, sum.blength);
***************
*** 256,265 ****
--- 267,295 ----
write_buf(f_out, sum2, sum.s2length);
len -= n1;...
2004 Mar 10
4
HFS+ resource forks: WIP patch included
...(size > 0) ) {
+ file_rf = make_file(fname_rf, &flist->string_area,
+ f == -1 && delete_excluded? SERVER_EXCLUDES
+ : ALL_EXCLUDES);
+
+ file_rf->dirname_dst = file->dirname;
+
+ if ( strcmp(hfs_mode,"darsplit") == 0 ) {
+ file_rf->basename_dst = new_array(char,
+ MAXPATHLEN);
+ if (!file_rf->basename_dst)
+ out_of_memory("hfs_rsrc_fork 2a");
+ sprintf(file_rf->basename_dst, "%s%s",
+ file->basename,suffix);
+ }
+
+ /* rprintf(FERROR,"darDEBUG: %s,%s to %s,%s\n",
+ file_rf->dirname,f...
2013 Jan 08
13
[PATCH 00/12] VMCI for Linux upstreaming
* * *
This series of VMCI linux upstreaming patches include latest udpate from
VMware to address Greg's and all other's code review comments.
Summary of changes:
- Rebase our linux kernel tree from v3.5 to v3.7.
- Fix all checkpatch warnings and errors. Fix some checkpatch with -strict
errors.
This addresses Greg's comment: On 15 Nov 2012
2013 Jan 08
13
[PATCH 00/12] VMCI for Linux upstreaming
* * *
This series of VMCI linux upstreaming patches include latest udpate from
VMware to address Greg's and all other's code review comments.
Summary of changes:
- Rebase our linux kernel tree from v3.5 to v3.7.
- Fix all checkpatch warnings and errors. Fix some checkpatch with -strict
errors.
This addresses Greg's comment: On 15 Nov 2012
2012 Oct 16
11
[PATCH 00/10] VMCI for Linux upstreaming
* * *
In an effort to improve the out-of-the-box experience with Linux
kernels for VMware users, VMware is working on readying the Virtual
Machine Communication Interface (vmw_vmci) and VMCI Sockets
(vmw_vsock) kernel modules for inclusion in the Linux kernel. The
purpose of this post is to acquire feedback on the vmw_vmci kernel
module. The vmw_vsock kernel module will be presented in a later
2012 Oct 16
11
[PATCH 00/10] VMCI for Linux upstreaming
* * *
In an effort to improve the out-of-the-box experience with Linux
kernels for VMware users, VMware is working on readying the Virtual
Machine Communication Interface (vmw_vmci) and VMCI Sockets
(vmw_vsock) kernel modules for inclusion in the Linux kernel. The
purpose of this post is to acquire feedback on the vmw_vmci kernel
module. The vmw_vsock kernel module will be presented in a later