Confirm your donation
Attn: Email user, We are pleased to announce that your "E address" was nominated as one of the 28 recipients under the Second category in the online DONATION SWEEPSTAKE 2020 Prospect as part of the Bill & Melinda Gates Foundation to relief Humanitarian struggle. For claims and clearance, kindly reply back with your SERIAL details: Bill/Melinda-S28/79712 OR call: +44-7443676180 on how to receive your donation cash prize of 650,000.00 Euro. Ms. JENET LAUREN SECRETARY. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Confirm your donation
Attn: Email user, We are pleased to announce that your "E address" was nominated as one of the 28 recipients under the Second category in the online DONATION SWEEPSTAKE 2020 Prospect as part of the Bill & Melinda Gates Foundation to relief Humanitarian struggle. For claims and clearance, kindly reply back with your SERIAL details: Bill/Melinda-S28/79712 OR call: +44-7443676180 on how to receive your donation cash prize of 650,000.00 Euro. Ms. JENET LAUREN SECRETARY. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: remove conversion to bool in halbtcoutsrc_Get()
Fix the following coccicheck warning: drivers/staging/rtl8723bs/hal/hal_btcoex.c:410:59-64: WARNING: conversion to bool not needed here Signed-off-by: Jason Yan --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index a6ed1bb9945e..3705a60a0546 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -407,7 +407,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) break; case BTC_GET_BL_WIFI_ENABLE_ENCRYPTION: - *pu8 = padapter->securitypriv.dot11PrivacyAlgrthm == 0 ? false : true; + *pu8 = padapter->securitypriv.dot11PrivacyAlgrthm != 0; break; case BTC_GET_BL_WIFI_UNDER_B_MODE: -- 2.21.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 21/21] staging: ion: fix sg_table nents vs. orig_nents misuse
The Documentation/DMA-API-HOWTO.txt states that dma_map_sg returns the numer of the created entries in the DMA address space. However the subsequent calls to dma_sync_sg_for_{device,cpu} and dma_unmap_sg must be called with the original number of entries passed to dma_map_sg. The sg_table->nents in turn holds the result of the dma_map_sg call as stated in include/linux/scatterlist.h. Adapt the code to obey those rules. Signed-off-by: Marek Szyprowski --- For more information, see '[PATCH v2 00/21] DRM: fix struct sg_table nents vs. orig_nents misuse' thread: https://lkml.org/lkml/2020/5/4/373 --- drivers/staging/android/ion/ion.c | 17 + drivers/staging/android/ion/ion_heap.c| 6 +++--- drivers/staging/android/ion/ion_system_heap.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 38b51ea..b14170c 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -147,14 +147,14 @@ static struct sg_table *dup_sg_table(struct sg_table *table) if (!new_table) return ERR_PTR(-ENOMEM); - ret = sg_alloc_table(new_table, table->nents, GFP_KERNEL); + ret = sg_alloc_table(new_table, table->orig_nents, GFP_KERNEL); if (ret) { kfree(new_table); return ERR_PTR(-ENOMEM); } new_sg = new_table->sgl; - for_each_sg(table->sgl, sg, table->nents, i) { + for_each_sg(table->sgl, sg, table->orig_nents, i) { memcpy(new_sg, sg, sizeof(*sg)); new_sg->dma_address = 0; new_sg = sg_next(new_sg); @@ -227,8 +227,9 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, table = a->table; - if (!dma_map_sg(attachment->dev, table->sgl, table->nents, - direction)) + table->nents = dma_map_sg(attachment->dev, table->sgl, + table->orig_nents, direction); + if (!table->nents) return ERR_PTR(-ENOMEM); return table; @@ -238,7 +239,7 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, struct sg_table *table, enum dma_data_direction direction) { - dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction); + dma_unmap_sg(attachment->dev, table->sgl, table->orig_nents, direction); } static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) @@ -297,7 +298,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { - dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents, + dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->orig_nents, direction); } @@ -320,8 +321,8 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); list_for_each_entry(a, &buffer->attachments, list) { - dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents, - direction); + dma_sync_sg_for_device(a->dev, a->table->sgl, + a->table->orig_nents, direction); } mutex_unlock(&buffer->lock); diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index 0755b11..f2f7ca7 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -38,7 +38,7 @@ void *ion_heap_map_kernel(struct ion_heap *heap, else pgprot = pgprot_writecombine(PAGE_KERNEL); - for_each_sg(table->sgl, sg, table->nents, i) { + for_each_sg(table->sgl, sg, table->orig_nents, i) { int npages_this_entry = PAGE_ALIGN(sg->length) / PAGE_SIZE; struct page *page = sg_page(sg); @@ -71,7 +71,7 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer, int i; int ret; - for_each_sg(table->sgl, sg, table->nents, i) { + for_each_sg(table->sgl, sg, table->orig_nents, i) { struct page *page = sg_page(sg); unsigned long remainder = vma->vm_end - addr; unsigned long len = sg->length; @@ -142,7 +142,7 @@ int ion_heap_buffer_zero(struct ion_buffer *buffer) else pgprot = pgprot_writecombine(PAGE_KERNEL); - return ion_heap_sglist_zero(table->sgl, table->nents, pgprot); + return ion_heap_sglist_zero(table->sgl, table->orig_nents, pgprot); } int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index b83a1d1..
[PATCH] staging: most: usb: fix exception handling
This patch fixes error handling on function parameters. Signed-off-by: Christian Gromm --- drivers/staging/most/usb/usb.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index e8c5a8c..e5276524 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -229,14 +229,14 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg) */ static int hdm_poison_channel(struct most_interface *iface, int channel) { - struct most_dev *mdev = to_mdev(iface); + struct most_dev *mdev; unsigned long flags; spinlock_t *lock; /* temp. lock */ if (unlikely(!iface)) { - dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n"); - return -EIO; + return -EFAULT; } + mdev = to_mdev(iface); if (unlikely(channel < 0 || channel >= iface->num_channels)) { dev_warn(&mdev->usb_device->dev, "Channel ID out of range.\n"); return -ECHRNG; @@ -278,13 +278,13 @@ static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) unsigned int j, num_frames; if (!frame_size) - return -EIO; + return -EFAULT; num_frames = mbo->buffer_length / frame_size; if (num_frames < 1) { dev_err(&mdev->usb_device->dev, "Missed minimal transfer unit.\n"); - return -EIO; + return -EINVAL; } for (j = num_frames - 1; j > 0; j--) @@ -312,7 +312,7 @@ static int hdm_remove_padding(struct most_dev *mdev, int channel, unsigned int j, num_frames; if (!frame_size) - return -EIO; + return -EFAULT; num_frames = mbo->processed_length / USB_MTU; for (j = 1; j < num_frames; j++) @@ -560,7 +560,7 @@ static int hdm_enqueue(struct most_interface *iface, int channel, void *virt_address; if (unlikely(!iface || !mbo)) - return -EIO; + return -EFAULT; if (unlikely(iface->num_channels <= channel || channel < 0)) return -ECHRNG; @@ -666,18 +666,18 @@ static int hdm_configure_channel(struct most_interface *iface, int channel, { unsigned int num_frames; unsigned int frame_size; - struct most_dev *mdev = to_mdev(iface); - struct device *dev = &mdev->usb_device->dev; + struct most_dev *mdev; + struct device *dev; + if (unlikely(!iface || !conf)) + return -EFAULT; + mdev = to_mdev(iface); + dev = &mdev->usb_device->dev; mdev->is_channel_healthy[channel] = true; mdev->clear_work[channel].channel = channel; mdev->clear_work[channel].mdev = mdev; INIT_WORK(&mdev->clear_work[channel].ws, wq_clear_halt); - if (unlikely(!iface || !conf)) { - dev_err(dev, "Bad interface or config pointer.\n"); - return -EINVAL; - } if (unlikely(channel < 0 || channel >= iface->num_channels)) { dev_err(dev, "Channel ID out of range.\n"); return -EINVAL; @@ -747,11 +747,12 @@ static void hdm_request_netinfo(struct most_interface *iface, int channel, { struct most_dev *mdev; - BUG_ON(!iface); + if (!iface || !on_netinfo) { + WARN_ON(1); + return; + } mdev = to_mdev(iface); mdev->on_netinfo = on_netinfo; - if (!on_netinfo) - return; mdev->link_stat_timer.expires = jiffies + HZ; mod_timer(&mdev->link_stat_timer, mdev->link_stat_timer.expires); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > This patch fixes error handling on function parameters. What does that mean? If I don't understand it, I think it needs to be made a lot more explicit as to why you are making these changes :) > Signed-off-by: Christian Gromm Any "Fixes:" tag for this? SHould it go to stable if it really resolves issues? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > This patch fixes error handling on function parameters. > > Signed-off-by: Christian Gromm > --- > drivers/staging/most/usb/usb.c | 33 + > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c > index e8c5a8c..e5276524 100644 > --- a/drivers/staging/most/usb/usb.c > +++ b/drivers/staging/most/usb/usb.c > @@ -229,14 +229,14 @@ static unsigned int get_stream_frame_size(struct > most_channel_config *cfg) > */ > static int hdm_poison_channel(struct most_interface *iface, int channel) > { > - struct most_dev *mdev = to_mdev(iface); > + struct most_dev *mdev; > unsigned long flags; > spinlock_t *lock; /* temp. lock */ > > if (unlikely(!iface)) { > - dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n"); > - return -EIO; > + return -EFAULT; -EFAULT is ONLY for when you have an error with copying memory to/from userspace. This should just be -EINVAL, right? And how can iface ever be NULL? And why unlikely() there, can you measure the difference with/without it? If not, please drop as the compiler/CPU can do it faster than you ever can. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: wilc1000: Increase the size of wid_list array
On Sun, May 03, 2020 at 04:29:53PM -0700, Joe Perches wrote: > On Sun, 2020-05-03 at 14:52 +, ajay.kat...@microchip.com wrote: > > On 03/05/20 1:21 pm, Oscar Carter wrote: > > > EXTERNAL EMAIL: Do not click links or open attachments unless you know > > > the content is safe > > > > > > Increase by one the size of wid_list array as index variable can reach a > > > value of 5. If this happens, an out-of-bounds access is performed. > > > > > > Addresses-Coverity-ID: 1451981 ("Out-of-bounds access") > > > Fixes: f5a3cb90b802d ("staging: wilc1000: add passive scan support") > > > Signed-off-by: Oscar Carter > [] > > > diff --git a/drivers/staging/wilc1000/hif.c > > > b/drivers/staging/wilc1000/hif.c > [] > > > @@ -151,7 +151,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, > > > u8 scan_type, > > > void *user_arg, struct cfg80211_scan_request *request) > > > { > > > int result = 0; > > > - struct wid wid_list[5]; > > > + struct wid wid_list[6]; > > This looks like it should be using a #define instead of > a hard-coded number. I agree. I will make the changes you suggested and I will resend a new version. > > > u32 index = 0; > > > u32 i, scan_timeout; > > > u8 *buffer; > > > -- > > > 2.20.1 > Thanks, Oscar Carter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] staging: wilc1000: Increase the size of wid_list array
Increase by one the size of wid_list array as index variable can reach a value of 5. If this happens, an out-of-bounds access is performed. Also, use a #define instead of a hard-coded literal for the new array size. Addresses-Coverity-ID: 1451981 ("Out-of-bounds access") Fixes: f5a3cb90b802d ("staging: wilc1000: add passive scan support") Acked-by: Ajay Singh Signed-off-by: Oscar Carter --- Changelog v1 -> v2 - Fix the commit for the "Fixes" tag as Ajay Singh suggested. Changelog v2 -> v3 - Use a #define instead of a hard-coded literal for the array size as Joe Perches suggested. - Add the "Acked-by" tag. drivers/staging/wilc1000/hif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c index 6c7de2f8d3f2..d025a3093015 100644 --- a/drivers/staging/wilc1000/hif.c +++ b/drivers/staging/wilc1000/hif.c @@ -11,6 +11,8 @@ #define WILC_FALSE_FRMWR_CHANNEL 100 +#define WILC_SCAN_WID_LIST_SIZE6 + struct wilc_rcvd_mac_info { u8 status; }; @@ -151,7 +153,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, void *user_arg, struct cfg80211_scan_request *request) { int result = 0; - struct wid wid_list[5]; + struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; u32 index = 0; u32 i, scan_timeout; u8 *buffer; -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, 2020-05-04 at 15:54 +0200, Greg KH wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > > This patch fixes error handling on function parameters. > > What does that mean? If I don't understand it, I think it needs to > be > made a lot more explicit as to why you are making these changes :) > > > Signed-off-by: Christian Gromm > > Any "Fixes:" tag for this? No. Just wanted to fix some obvious things, before adding it to stable, as discussed in our last email thread. > > SHould it go to stable if it really resolves issues? No. Once you accept this, I'll add it to stable anyway. thanks, Chris ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, 2020-05-04 at 15:55 +0200, Greg KH wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > > This patch fixes error handling on function parameters. > > > > Signed-off-by: Christian Gromm > > --- > > drivers/staging/most/usb/usb.c | 33 +- > > --- > > 1 file changed, 17 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/staging/most/usb/usb.c > > b/drivers/staging/most/usb/usb.c > > index e8c5a8c..e5276524 100644 > > --- a/drivers/staging/most/usb/usb.c > > +++ b/drivers/staging/most/usb/usb.c > > @@ -229,14 +229,14 @@ static unsigned int > > get_stream_frame_size(struct most_channel_config *cfg) > > */ > > static int hdm_poison_channel(struct most_interface *iface, int > > channel) > > { > > - struct most_dev *mdev = to_mdev(iface); > > + struct most_dev *mdev; > > unsigned long flags; > > spinlock_t *lock; /* temp. lock */ > > > > if (unlikely(!iface)) { > > - dev_warn(&mdev->usb_device->dev, "Poison: Bad > > interface.\n"); > > - return -EIO; > > + return -EFAULT; > > -EFAULT is ONLY for when you have an error with copying memory > to/from > userspace. Ok. > > This should just be -EINVAL, right? > > And how can iface ever be NULL? It should never become NULL. But you never know, right? Too paranoid? > > And why unlikely() there, can you measure the difference with/without > it? If not, please drop as the compiler/CPU can do it faster than > you > ever can. > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, May 04, 2020 at 03:22:08PM +, christian.gr...@microchip.com wrote: > On Mon, 2020-05-04 at 15:55 +0200, Greg KH wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you > > know the content is safe > > > > On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > > > This patch fixes error handling on function parameters. > > > > > > Signed-off-by: Christian Gromm > > > --- > > > drivers/staging/most/usb/usb.c | 33 +- > > > --- > > > 1 file changed, 17 insertions(+), 16 deletions(-) > > > > > > diff --git a/drivers/staging/most/usb/usb.c > > > b/drivers/staging/most/usb/usb.c > > > index e8c5a8c..e5276524 100644 > > > --- a/drivers/staging/most/usb/usb.c > > > +++ b/drivers/staging/most/usb/usb.c > > > @@ -229,14 +229,14 @@ static unsigned int > > > get_stream_frame_size(struct most_channel_config *cfg) > > > */ > > > static int hdm_poison_channel(struct most_interface *iface, int > > > channel) > > > { > > > - struct most_dev *mdev = to_mdev(iface); > > > + struct most_dev *mdev; > > > unsigned long flags; > > > spinlock_t *lock; /* temp. lock */ > > > > > > if (unlikely(!iface)) { > > > - dev_warn(&mdev->usb_device->dev, "Poison: Bad > > > interface.\n"); > > > - return -EIO; > > > + return -EFAULT; > > > > -EFAULT is ONLY for when you have an error with copying memory > > to/from > > userspace. > > Ok. > > > > > This should just be -EINVAL, right? > > > > And how can iface ever be NULL? > > It should never become NULL. But you never know, right? > Too paranoid? Yes, never check things that can not happen otherwise all functions would be nothing but checking parameters all the time. So just drop this check entirely. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, May 04, 2020 at 03:17:53PM +, christian.gr...@microchip.com wrote: > On Mon, 2020-05-04 at 15:54 +0200, Greg KH wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you > > know the content is safe > > > > On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > > > This patch fixes error handling on function parameters. > > > > What does that mean? If I don't understand it, I think it needs to > > be > > made a lot more explicit as to why you are making these changes :) > > > > > Signed-off-by: Christian Gromm > > > > Any "Fixes:" tag for this? > > No. Just wanted to fix some obvious things, before adding > it to stable, as discussed in our last email thread. Remember, no one has context when reading a git commit log, please spell it out :) > > SHould it go to stable if it really resolves issues? > > No. Once you accept this, I'll add it to stable anyway. How? Put the cc: stable on a patch if it fixes a real bug. I don't see what this "fixes" still... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: usb: fix exception handling
On Mon, 2020-05-04 at 17:39 +0200, Greg KH wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > On Mon, May 04, 2020 at 03:17:53PM +, > christian.gr...@microchip.com wrote: > > On Mon, 2020-05-04 at 15:54 +0200, Greg KH wrote: > > > EXTERNAL EMAIL: Do not click links or open attachments unless you > > > know the content is safe > > > > > > On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote: > > > > This patch fixes error handling on function parameters. > > > > > > What does that mean? If I don't understand it, I think it needs > > > to > > > be > > > made a lot more explicit as to why you are making these changes > > > :) > > > > > > > Signed-off-by: Christian Gromm > > > > > > Any "Fixes:" tag for this? > > > > No. Just wanted to fix some obvious things, before adding > > it to stable, as discussed in our last email thread. > > Remember, no one has context when reading a git commit log, please > spell > it out :) > > > > SHould it go to stable if it really resolves issues? > > > > No. Once you accept this, I'll add it to stable anyway. > > How? Put the cc: stable on a patch if it fixes a real bug. I don't > see > what this "fixes" still... The interface pointer provided as a function parameter has already been used before it has been checked against NULL. :( Once I have the unnecessary parameter checking removed, the problem will be removed too. Can you please drop this patch and I'll send a new one. V2 does not make very much sense, as the patch will be doing somethig differnt now. thanks, Chris ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vt6656: Use const for read only data
Use const for the arrays that are used as "read only". Also, modify the prototype of vnt_control_out_blocks() function to use a pointer to a const type. The vnt_vt3184_al2230 array can't be converted to const as it's modified later. Then in the vnt_vt3184_init() function use two types of pointers (to const type and to no const type) to avoid the compiler warning: assignment discards 'const' qualifiers from pointer target type This way decrease the .data section and increase the .rodata section limiting the surface attack. Before this change: --- drivers/staging/vt6656/baseband.o : section size addr .text1278 0 .data 576 0 .bss0 0 .rodata 319 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 32 0 Total2250 After this change: -- drivers/staging/vt6656/baseband.o : section size addr .text1278 0 .data 256 0 .bss0 0 .rodata 640 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 32 0 Total2251 Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 14 +- drivers/staging/vt6656/usbpipe.c | 2 +- drivers/staging/vt6656/usbpipe.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 1d75acaec8f3..41ae779ec61f 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -31,7 +31,7 @@ #include "rf.h" #include "usbpipe.h" -static u8 vnt_vt3184_agc[] = { +static const u8 vnt_vt3184_agc[] = { 0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x06, 0x06, 0x08, 0x08, 0x0a, 0x0a, 0x0c, 0x0c, 0x0e, 0x0e, /* 0x0f */ 0x10, 0x10, 0x12, 0x12, 0x14, 0x14, 0x16, 0x16, @@ -78,7 +78,7 @@ static u8 vnt_vt3184_al2230[] = { }; /* {{RobertYu:20060515, new BB setting for VT3226D0 */ -static u8 vnt_vt3184_vt3226d0[] = { +static const u8 vnt_vt3184_vt3226d0[] = { 0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -243,7 +243,8 @@ int vnt_vt3184_init(struct vnt_private *priv) { int ret; u16 length; - u8 *addr; + u8 *addr = NULL; + const u8 *c_addr; u8 data; ret = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, MESSAGE_REQUEST_EEPROM, @@ -275,7 +276,7 @@ int vnt_vt3184_init(struct vnt_private *priv) (priv->rf_type == RF_VT3342A0)) { priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); - addr = vnt_vt3184_vt3226d0; + c_addr = vnt_vt3184_vt3226d0; priv->bb_vga[0] = 0x20; priv->bb_vga[1] = 0x10; @@ -291,8 +292,11 @@ int vnt_vt3184_init(struct vnt_private *priv) goto end; } + if (addr) + c_addr = addr; + ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE, -MESSAGE_REQUEST_BBREG, length, addr); +MESSAGE_REQUEST_BBREG, length, c_addr); if (ret) goto end; diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 91b62c3dff7b..fb5e1b0dce6b 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -77,7 +77,7 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data) } int vnt_control_out_blocks(struct vnt_private *priv, - u16 block, u8 reg, u16 length, u8 *data) + u16 block, u8 reg, u16 length, const u8 *data) { int ret = 0, i; diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index 35697b58d748..1f0b2566c288 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -52,7 +52,7 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 ref_off, u8 data); int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data); int vnt_control_out_blocks(struct vnt_private *priv, - u16 block, u8 reg, u16 len, u8 *data); + u16 block, u8 reg, u16 len, const u8 *data); int vnt_start_interrupt_urb(struct vnt_private *priv); int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb); -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel