Displaying 20 results from an estimated 338 matches for "buflen".
2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
...we want to crash whenever the ring is screwed. */
#define BAD_RING(_vq, fmt, args...) \
@@ -105,6 +108,9 @@ struct vring_virtqueue_split {
struct vring_desc_state_split *desc_state;
struct vring_desc_extra *desc_extra;
+ /* Maximum in buffer length, NULL means no used validation */
+ u32 *buflen;
+
/* DMA address and size information */
dma_addr_t queue_dma_addr;
size_t queue_size_in_bytes;
@@ -145,6 +151,9 @@ struct vring_virtqueue_packed {
struct vring_desc_state_packed *desc_state;
struct vring_desc_extra *desc_extra;
+ /* Maximum in buffer length, NULL means no used validat...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...t vring_desc_state_split *desc_state;
> > > > > > > struct vring_desc_extra *desc_extra;
> > > > > > >
> > > > > > > + /* Maximum in buffer length, NULL means no used validation */
> > > > > > > + u32 *buflen;
> > > > > > > +
> > > > > > > /* DMA address and size information */
> > > > > > > dma_addr_t queue_dma_addr;
> > > > > > > size_t queue_size_in_bytes;
> > > > > > > @@ -145,6...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...plit *desc_state;
> > > > > > > > struct vring_desc_extra *desc_extra;
> > > > > > > >
> > > > > > > > + /* Maximum in buffer length, NULL means no used validation */
> > > > > > > > + u32 *buflen;
> > > > > > > > +
> > > > > > > > /* DMA address and size information */
> > > > > > > > dma_addr_t queue_dma_addr;
> > > > > > > > size_t queue_size_in_bytes;
> > > > >...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...plit *desc_state;
> > > > > > > > struct vring_desc_extra *desc_extra;
> > > > > > > >
> > > > > > > > + /* Maximum in buffer length, NULL means no used validation */
> > > > > > > > + u32 *buflen;
> > > > > > > > +
> > > > > > > > /* DMA address and size information */
> > > > > > > > dma_addr_t queue_dma_addr;
> > > > > > > > size_t queue_size_in_bytes;
> > > > >...
2010 Dec 09
1
[PATCH 1/1] Properly check return values of kmalloc and vmbus_recvpacket
...rivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c
index 53e1e29..ac68575 100644
--- a/drivers/staging/hv/hv_utils.c
+++ b/drivers/staging/hv/hv_utils.c
@@ -43,21 +43,27 @@ static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
u8 *buf;
- u32 buflen, recvlen;
+ u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
+ int ret = 0;
struct shutdown_msg_data *shutdown_msg;
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- buflen = PAGE_SIZE;
- buf = kmalloc(buflen, GFP_ATOMIC);
+ buf = kmalloc(PAGE_SIZE, GFP_A...
2010 Dec 09
1
[PATCH 1/1] Properly check return values of kmalloc and vmbus_recvpacket
...rivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c
index 53e1e29..ac68575 100644
--- a/drivers/staging/hv/hv_utils.c
+++ b/drivers/staging/hv/hv_utils.c
@@ -43,21 +43,27 @@ static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
u8 *buf;
- u32 buflen, recvlen;
+ u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
+ int ret = 0;
struct shutdown_msg_data *shutdown_msg;
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- buflen = PAGE_SIZE;
- buf = kmalloc(buflen, GFP_ATOMIC);
+ buf = kmalloc(PAGE_SIZE, GFP_A...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...t; > > > > > > > > struct vring_desc_extra *desc_extra;
> > > > > > > > >
> > > > > > > > > + /* Maximum in buffer length, NULL means no used validation */
> > > > > > > > > + u32 *buflen;
> > > > > > > > > +
> > > > > > > > > /* DMA address and size information */
> > > > > > > > > dma_addr_t queue_dma_addr;
> > > > > > > > > size_t queue_size_in_bytes;
>...
2010 Dec 13
3
[PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
.../hv/hv_utils.c
@@ -38,12 +38,14 @@
#include "vmbus_api.h"
#include "utils.h"
+static u8 *shut_txf_buf;
+static u8 *time_txf_buf;
+static u8 *hbeat_txf_buf;
static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
- u8 *buf;
- u32 buflen, recvlen;
+ u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
@@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context)
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- buflen = PAGE_SIZE;
- buf = kmalloc(buflen, GFP_ATOMIC);
-
- vmbus_recvpac...
2010 Dec 13
3
[PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
.../hv/hv_utils.c
@@ -38,12 +38,14 @@
#include "vmbus_api.h"
#include "utils.h"
+static u8 *shut_txf_buf;
+static u8 *time_txf_buf;
+static u8 *hbeat_txf_buf;
static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
- u8 *buf;
- u32 buflen, recvlen;
+ u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
@@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context)
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- buflen = PAGE_SIZE;
- buf = kmalloc(buflen, GFP_ATOMIC);
-
- vmbus_recvpac...
2010 Nov 22
6
[PATCH 2/3]: An Implementation of HyperV KVP functionality
The hv_utils module will be composed of more than one file;
rename hv_utils.c to accommodate this without changing the module name.
Signed-off-by: K. Y. Srinivasan <ksrinivasan at novell.com>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hv_util_cleanup.patch
Url:
2010 Nov 22
6
[PATCH 2/3]: An Implementation of HyperV KVP functionality
The hv_utils module will be composed of more than one file;
rename hv_utils.c to accommodate this without changing the module name.
Signed-off-by: K. Y. Srinivasan <ksrinivasan at novell.com>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hv_util_cleanup.patch
Url:
2020 Apr 03
0
Patch to support Powercool PCRACK-1200VA
...first post on nut-upsdev.
I would like to share a small patch to enable support for the Powercool
PCRACK 1200VA ups.
I found that the UPS uses megatec/krauler protocol but is sensitive to
the USB buffer length passed to it in requests via usb_get_string(), and
usb_get_string_simple().
If the buflen is greater than 102 then the ups will reply to requests
but does not behave correctly. In this case the responses to "Q1"
commands contain constant stale data that is never updated.
This patch adds a parameter to the nutdrv_qx driver that allows the
value of buflen to be set explicitl...
2020 Apr 03
0
Powercool PCRACK-1200VA patch update
...ing() that is implemented in
libusb.c
This was necessary in order to make the bufflen_fix available in
libusb.c where usb_get_string() is called in libusb_open()
This wrapper function mops up and hides all the work concerned with
handling of langid and bufflen.
The static vars langid_fix and buflen_fix are accordingly moved to libusb.c
regards,
Ian
diff --git a/drivers/libusb.c b/drivers/libusb.c
index 0eb054a7..42f1b93f 100644
--- a/drivers/libusb.c
+++ b/drivers/libusb.c
@@ -36,6 +36,7 @@
#define USB_DRIVER_NAME "USB communication driver"
#define USB_DRIVER_VERSIO...
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...-1642,7 +1642,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> int len, int *skb_xdp)
> {
> struct page_frag *alloc_frag = ¤t->task_frag;
> - struct sk_buff *skb;
> + struct sk_buff *skb = NULL;
> struct bpf_prog *xdp_prog;
> int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> unsigned int delta = 0;
> @@ -1668,6 +1668,9 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> if (copied != len)
> return ERR_PTR(-EFAULT);
>
> + get_page(alloc_frag->page);
> + alloc_frag->offs...
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...-1642,7 +1642,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> int len, int *skb_xdp)
> {
> struct page_frag *alloc_frag = ¤t->task_frag;
> - struct sk_buff *skb;
> + struct sk_buff *skb = NULL;
> struct bpf_prog *xdp_prog;
> int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> unsigned int delta = 0;
> @@ -1668,6 +1668,9 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> if (copied != len)
> return ERR_PTR(-EFAULT);
>
> + get_page(alloc_frag->page);
> + alloc_frag->offs...
2018 May 21
2
[RFC PATCH net-next 10/12] vhost_net: build xdp buff
...e *nvq,
> + struct iov_iter *from,
> + struct xdp_buff *xdp)
> +{
> + struct vhost_virtqueue *vq = &nvq->vq;
> + struct page_frag *alloc_frag = ¤t->task_frag;
> + struct virtio_net_hdr *gso;
> + size_t len = iov_iter_count(from);
> + int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> + int pad = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + VHOST_NET_HEADROOM
> + + nvq->sock_hlen);
> + int sock_hlen = nvq->sock_hlen;
> + void *buf;
> + int copied;
> +
> + if (len < nvq->sock_hlen)
> + return -EFAUL...
2013 Nov 13
4
[PATCH net-next 4/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...geable(struct receive_queue *rq, gfp_t gfp)
> {
> struct virtnet_info *vi = rq->vq->vdev->priv;
> + const size_t hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
> struct page_frag *alloc_frag;
> char *buf;
> - int err, len, hole;
> + int err, hole;
> + u32 buflen;
>
> + buflen = hdr_len + clamp_t(u32, ewma_read(&rq->mrg_avg_pkt_len),
> + GOOD_PACKET_LEN, PAGE_SIZE - hdr_len);
> + buflen = ALIGN(buflen, L1_CACHE_BYTES);
> alloc_frag = (gfp & __GFP_WAIT) ? &vi->sleep_frag : &rq->atomic_frag;
> - if (unlikel...
2013 Nov 13
4
[PATCH net-next 4/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...geable(struct receive_queue *rq, gfp_t gfp)
> {
> struct virtnet_info *vi = rq->vq->vdev->priv;
> + const size_t hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
> struct page_frag *alloc_frag;
> char *buf;
> - int err, len, hole;
> + int err, hole;
> + u32 buflen;
>
> + buflen = hdr_len + clamp_t(u32, ewma_read(&rq->mrg_avg_pkt_len),
> + GOOD_PACKET_LEN, PAGE_SIZE - hdr_len);
> + buflen = ALIGN(buflen, L1_CACHE_BYTES);
> alloc_frag = (gfp & __GFP_WAIT) ? &vi->sleep_frag : &rq->atomic_frag;
> - if (unlikel...
2010 Dec 13
3
[PATCH 1/1] hv: Use only one txf buffer per channel and kmalloc on initialize
.../hv/hv_utils.c
@@ -38,12 +38,14 @@
#include "vmbus_api.h"
#include "utils.h"
+static u8 *shut_txf_buf;
+static u8 *time_txf_buf;
+static u8 *hbeat_txf_buf;
static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
- u8 *buf;
- u32 buflen, recvlen;
+ u32 recvlen;
u64 requestid;
u8 execute_shutdown = false;
@@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context)
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- buflen = PAGE_SIZE;
- buf = kmalloc(buflen, GFP_ATOMIC);
-
- vmbus_recvpac...
2017 Jul 18
1
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...unsigned int *len)
> +{
> + struct page *page = alloc_page(GFP_ATOMIC);
> +
> + if (!page)
> + return NULL;
> +
> + memcpy(page_address(page) + page_off, page_address(p) + offset, *len);
> + page_off += *len;
> +
> + while (--*num_buf) {
> + unsigned int buflen;
> + void *buf;
> + int off;
> +
> + buf = virtqueue_get_buf(rq->vq, &buflen);
> + if (unlikely(!buf))
> + goto err_buf;
> +
> + p = virt_to_head_page(buf);
> + off = buf - page_address(p);
> +
> + /* guard against a misconfigured or uncooperative ba...