Same symbol with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL

2021-01-09 Thread Thomas Meyer
Hi,

I have a question regarding EXPORT_SYMBOL vs. EXPORT_SYMBOL_GPL:
I did stumble upon different export declarations between different 
architectures, e.g.:

$ grep -r -e "EXPORT_SYMBOL[^(]*(" * | tr ":()" "   " | sort -s -k 3 -k 2  | 
grep __virt_addr_valid
arch/mips/mm/mmap.c EXPORT_SYMBOL_GPL __virt_addr_valid ;
arch/x86/mm/physaddr.c EXPORT_SYMBOL __virt_addr_valid ;

Bug or feature?

Other examples are:
clk_disable EXPORT_SYMBOL   7
clk_disable EXPORT_SYMBOL_GPL   3
clk_enable  EXPORT_SYMBOL   7
clk_enable  EXPORT_SYMBOL_GPL   3
clk_get_parent  EXPORT_SYMBOL   4
clk_get_parent  EXPORT_SYMBOL_GPL   2
clk_get_rateEXPORT_SYMBOL   7
clk_get_rateEXPORT_SYMBOL_GPL   3
clk_registerEXPORT_SYMBOL   2
clk_registerEXPORT_SYMBOL_GPL   2
clk_round_rate  EXPORT_SYMBOL   6
clk_round_rate  EXPORT_SYMBOL_GPL   4
clk_set_parent  EXPORT_SYMBOL   5
clk_set_parent  EXPORT_SYMBOL_GPL   2
clk_set_rateEXPORT_SYMBOL   6
clk_set_rateEXPORT_SYMBOL_GPL   4
clk_unregister  EXPORT_SYMBOL   2
clk_unregister  EXPORT_SYMBOL_GPL   2
copy_user_highpage  EXPORT_SYMBOL   4
copy_user_highpage  EXPORT_SYMBOL_GPL   1
cpu_have_featureEXPORT_SYMBOL   1
cpu_have_featureEXPORT_SYMBOL_GPL   1
ec_read EXPORT_SYMBOL   1
ec_read EXPORT_SYMBOL_GPL   1
ec_writeEXPORT_SYMBOL   1
ec_writeEXPORT_SYMBOL_GPL   1
elf_hwcap   EXPORT_SYMBOL   2
elf_hwcap   EXPORT_SYMBOL_GPL   2
empty_zero_page EXPORT_SYMBOL   26
empty_zero_page EXPORT_SYMBOL_GPL   1
flush_icache_range  EXPORT_SYMBOL   9
flush_icache_range  EXPORT_SYMBOL_GPL   2
ioremap_uc  EXPORT_SYMBOL   1
ioremap_uc  EXPORT_SYMBOL_GPL   1
irq_of_parse_and_mapEXPORT_SYMBOL   1
irq_of_parse_and_mapEXPORT_SYMBOL_GPL   1
irq_to_desc EXPORT_SYMBOL   1
irq_to_desc EXPORT_SYMBOL_GPL   1
machine_power_off   EXPORT_SYMBOL   1
machine_power_off   EXPORT_SYMBOL_GPL   1
memcpy_flushcache   EXPORT_SYMBOL   1
memcpy_flushcache   EXPORT_SYMBOL_GPL   1
memstart_addr   EXPORT_SYMBOL   1
memstart_addr   EXPORT_SYMBOL_GPL   1
node_data   EXPORT_SYMBOL   7
node_data   EXPORT_SYMBOL_GPL   1
pci_domain_nr   EXPORT_SYMBOL   2
pci_domain_nr   EXPORT_SYMBOL_GPL   1
pci_iomap_wcEXPORT_SYMBOL   1
pci_iomap_wcEXPORT_SYMBOL_GPL   1
pci_iomap_wc_range  EXPORT_SYMBOL   1
pci_iomap_wc_range  EXPORT_SYMBOL_GPL   1
perf_num_counters   EXPORT_SYMBOL   1
perf_num_counters   EXPORT_SYMBOL_GPL   2
perf_pmu_name   EXPORT_SYMBOL   1
perf_pmu_name   EXPORT_SYMBOL_GPL   2
pm_power_offEXPORT_SYMBOL   22
pm_power_offEXPORT_SYMBOL_GPL   3
pv_ops  EXPORT_SYMBOL   1
pv_ops  EXPORT_SYMBOL_GPL   2
rcu_barrier EXPORT_SYMBOL   1
rcu_barrier EXPORT_SYMBOL_GPL   1
return_address  EXPORT_SYMBOL   1
return_address  EXPORT_SYMBOL_GPL   3
rtc_lockEXPORT_SYMBOL   5
rtc_lockEXPORT_SYMBOL_GPL   2
save_stack_traceEXPORT_SYMBOL   1
save_stack_traceEXPORT_SYMBOL_GPL   14
save_stack_trace_tskEXPORT_SYMBOL   1
save_stack_trace_tskEXPORT_SYMBOL_GPL   11
smp_call_function_single_async  EXPORT_SYMBOL   1
smp_call_function_single_async  EXPORT_SYMBOL_GPL   1
start_threadEXPORT_SYMBOL   4
start_threadEXPORT_SYMBOL_GPL   2
ww_mutex_lock   EXPORT_SYMBOL   1
ww_mutex_lock   EXPORT_SYMBOL_GPL   1
ww_mutex_lock_interruptible EXPORT_SYMBOL   1
ww_mutex_lock_interruptible EXPORT_SYMBOL_GPL   1
xen_domain_type EXPORT_SYMBOL   1
xen_domain_type EXPORT_SYMBOL_GPL   1
xen_start_info  EXPORT_SYMBOL   1
xen_start_info  EXPORT_SYMBOL_GPL   1

Mfg
thomas


[PATCH 1/2] lib/bsearch.c: introduce bsearch_idx

2019-10-19 Thread Thomas Meyer
many existing bsearch implementations don't want to have the pointer to the
found element, but the index position, or if the searched element doesn't
exist, the index position the search element would be placed in the array.

Signed-off-by: Thomas Meyer 
---
 include/linux/bsearch.h |  7 +
 lib/bsearch.c   | 62 +
 2 files changed, 58 insertions(+), 11 deletions(-)

diff --git a/include/linux/bsearch.h b/include/linux/bsearch.h
index 62b1eb3488584..0c40c8b39b881 100644
--- a/include/linux/bsearch.h
+++ b/include/linux/bsearch.h
@@ -7,4 +7,11 @@
 void *bsearch(const void *key, const void *base, size_t num, size_t size,
  int (*cmp)(const void *key, const void *elt));
 
+struct bsearch_result { size_t idx; bool found; };
+
+struct bsearch_result bsearch_idx(const void *key, const void *base,
+ size_t num,
+ size_t size,
+ int (*cmp)(const void *key, const void *elt));
+
 #endif /* _LINUX_BSEARCH_H */
diff --git a/lib/bsearch.c b/lib/bsearch.c
index 8baa839681628..5c46d0ec1e473 100644
--- a/lib/bsearch.c
+++ b/lib/bsearch.c
@@ -10,8 +10,8 @@
 #include 
 #include 
 
-/*
- * bsearch - binary search an array of elements
+/**
+ * bsearch() - binary search an array of elements
  * @key: pointer to item being searched for
  * @base: pointer to first element to search
  * @num: number of elements
@@ -27,28 +27,68 @@
  * could compare the string with the struct's name field.  However, if
  * the key and elements in the array are of the same type, you can use
  * the same comparison function for both sort() and bsearch().
+ *
+ * Return: Either a pointer to the search element or NULL if not found.
  */
 void *bsearch(const void *key, const void *base, size_t num, size_t size,
  int (*cmp)(const void *key, const void *elt))
 {
-   const char *pivot;
+   struct bsearch_result idx = bsearch_idx(key, base, num, size, cmp);
+
+   if (idx.found == true)
+   return (void *)base + idx.idx * size;
+
+   return NULL;
+}
+EXPORT_SYMBOL(bsearch);
+NOKPROBE_SYMBOL(bsearch);
+
+/**
+ * bsearch_idx() - binary search an array of elements
+ * @key: pointer to item being searched for
+ * @base: pointer to first element to search
+ * @num: number of elements
+ * @size: size of each element
+ * @cmp: pointer to comparison function
+ *
+ * This function does a binary search on the given array.  The
+ * contents of the array should already be in ascending sorted order
+ * under the provided comparison function.
+ *
+ * Returns an index position and a bool if an exact match was found
+ * if an exact match was found the idx is the index in the base array.
+ * if no exact match was found the idx will point the the next higher index
+ * entry in the base array. this can also be base[num], i.e. after the actual
+ * allocated array.
+ */
+struct bsearch_result bsearch_idx(const void *key, const void *base,
+ size_t num,
+ size_t size,
+ int (*cmp)(const void *key, const void *elt))
+{
+   struct bsearch_result res = { .found = false };
int result;
+   size_t base_idx = 0;
+   size_t pivot_idx;
 
while (num > 0) {
-   pivot = base + (num >> 1) * size;
-   result = cmp(key, pivot);
+   pivot_idx = base_idx + (num >> 1);
+   result = cmp(key, base + pivot_idx * size);
 
-   if (result == 0)
-   return (void *)pivot;
+   if (result == 0) {
+   res.idx = pivot_idx;
+   res.found = true;
+   return res;
+   }
 
if (result > 0) {
-   base = pivot + size;
+   base_idx = pivot_idx + 1;
num--;
}
num >>= 1;
}
 
-   return NULL;
+   res.idx = base_idx;
+   return res;
 }
-EXPORT_SYMBOL(bsearch);
-NOKPROBE_SYMBOL(bsearch);
+EXPORT_SYMBOL(bsearch_idx);
-- 
2.21.0



[PATCH 2/2] xfs: replace homemade binary search

2019-10-19 Thread Thomas Meyer
use newly introduced bsearch_idx instead.

Signed-off-by: Thomas Meyer 
---
 fs/xfs/libxfs/xfs_dir2_block.c | 30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
index 9595ced393dce..e484ec68944fb 100644
--- a/fs/xfs/libxfs/xfs_dir2_block.c
+++ b/fs/xfs/libxfs/xfs_dir2_block.c
@@ -20,6 +20,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_log.h"
+#include 
 
 /*
  * Local function prototypes.
@@ -314,6 +315,19 @@ xfs_dir2_block_compact(
xfs_dir2_data_freescan(args->dp, hdr, needlog);
 }
 
+static int cmp_hashval(const void *key, const void *elt)
+{
+   xfs_dahash_t _search_key = *(xfs_dahash_t *)key;
+   xfs_dahash_t _curren_key = be32_to_cpu((
+   (xfs_dir2_leaf_entry_t *) elt)->hashval);
+
+   if (_search_key == _curren_key)
+   return 0;
+   else if (_search_key < _curren_key)
+   return -1;
+   return 1;
+}
+
 /*
  * Add an entry to a block directory.
  */
@@ -331,19 +345,17 @@ xfs_dir2_block_addname(
xfs_dir2_data_unused_t  *dup;   /* block unused entry */
int error;  /* error return value */
xfs_dir2_data_unused_t  *enddup=NULL;   /* unused at end of data */
-   xfs_dahash_thash;   /* hash value of found entry */
-   int high;   /* high index for binary srch */
int highstale;  /* high stale index */
int lfloghigh=0;/* last final leaf to log */
int lfloglow=0; /* first final leaf to log */
int len;/* length of the new entry */
-   int low;/* low index for binary srch */
int lowstale;   /* low stale index */
int mid=0;  /* midpoint for binary srch */
int needlog;/* need to log header */
int needscan;   /* need to rescan freespace */
__be16  *tagp;  /* pointer to tag value */
xfs_trans_t *tp;/* transaction structure */
+   struct bsearch_result   idx;/* bsearch result */
 
trace_xfs_dir2_block_addname(args);
 
@@ -420,15 +432,9 @@ xfs_dir2_block_addname(
/*
 * Find the slot that's first lower than our hash value, -1 if none.
 */
-   for (low = 0, high = be32_to_cpu(btp->count) - 1; low <= high; ) {
-   mid = (low + high) >> 1;
-   if ((hash = be32_to_cpu(blp[mid].hashval)) == args->hashval)
-   break;
-   if (hash < args->hashval)
-   low = mid + 1;
-   else
-   high = mid - 1;
-   }
+   idx = bsearch_idx(>hashval, blp, be32_to_cpu(btp->count) - 1,
+ sizeof(xfs_dir2_leaf_entry_t), cmp_hashval);
+   mid = idx.idx;
while (mid >= 0 && be32_to_cpu(blp[mid].hashval) >= args->hashval) {
mid--;
}
-- 
2.21.0



Re: [PATCH] kernel/groups.c: use bsearch library function

2019-10-09 Thread Thomas Meyer
Rasmus Villemoes  writes:

> On 07/10/2019 21.26, Thomas Meyer wrote:
>> commit b7b2562f7252 ("kernel/groups.c: use sort library function")
>> introduced the sort library function.
>> also use the bsearch library function instead of open-coding the binary
>> search.

Hi,

> Yes, but please note the difference between sorting the group_info and
> searching it: The former is done quite rarely - the setgroups syscall is
> used roughly once per login-session.
>
> But the searching of that structure is done more or less every time a
> user accesses a file not owned by that user (e.g., any time a normal
> user accesses anything in /usr) - at least if I'm reading
> acl_permission_check() right.
>
> So using a callback-based interface, especially in a post-spectre world,
> may have a somewhat large performance impact.

okay, so the code is duplicated for performance reasons? nothing a
compiler can inline, I guess.

so what about a comment instead:

diff --git a/kernel/groups.c b/kernel/groups.c
index daae2f2dc6d4f..46b5d4cd53c2e 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -93,7 +93,7 @@ void groups_sort(struct group_info *group_info)
 }
 EXPORT_SYMBOL(groups_sort);
 
-/* a simple bsearch */
+/* duplicate code from lib/bsearch.c for performance reasons */
 int groups_search(const struct group_info *group_info, kgid_t grp)
 {
unsigned int left, right;


Mfg
thomas


[PATCH] kernel/groups.c: use bsearch library function

2019-10-07 Thread Thomas Meyer
commit b7b2562f7252 ("kernel/groups.c: use sort library function")
introduced the sort library function.
also use the bsearch library function instead of open-coding the binary
search.

Signed-off-by: Thomas Meyer 
---
 kernel/groups.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/kernel/groups.c b/kernel/groups.c
index daae2f2dc6d4f..69561a9cb4d39 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -2,6 +2,7 @@
 /*
  * Supplementary group IDs
  */
+#include 
 #include 
 #include 
 #include 
@@ -96,22 +97,12 @@ EXPORT_SYMBOL(groups_sort);
 /* a simple bsearch */
 int groups_search(const struct group_info *group_info, kgid_t grp)
 {
-   unsigned int left, right;
-
if (!group_info)
return 0;
 
-   left = 0;
-   right = group_info->ngroups;
-   while (left < right) {
-   unsigned int mid = (left+right)/2;
-   if (gid_gt(grp, group_info->gid[mid]))
-   left = mid + 1;
-   else if (gid_lt(grp, group_info->gid[mid]))
-   right = mid;
-   else
-   return 1;
-   }
+   if (bsearch(, group_info->gid, group_info->ngroups,
+   sizeof(*group_info->gid), gid_cmp))
+   return 1;
return 0;
 }
 
-- 
2.21.0



[PATCH] counter: ftm-quaddec: needs HAS_IOMEM

2019-06-01 Thread Thomas Meyer
the driver fails for UML with:
drivers/counter/ftm-quaddec.c:301: undefined reference to `devm_ioremap'

Fix it by depending on HAS_IOMEM
---
 drivers/counter/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig
index 138ecd8a8fbd..6298344b536b 100644
--- a/drivers/counter/Kconfig
+++ b/drivers/counter/Kconfig
@@ -50,6 +50,7 @@ config STM32_LPTIMER_CNT
  module will be called stm32-lptimer-cnt.
 
 config FTM_QUADDEC
+   depends on HAS_IOMEM
tristate "Flex Timer Module Quadrature decoder driver"
help
  Select this option to enable the Flex Timer Quadrature decoder
-- 
2.21.0



[PATCH] scsi: pmcraid: Use *_pool_zalloc rather than *_pool_alloc

2019-05-29 Thread Thomas Meyer
Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4668,18 +4668,14 @@ static int pmcraid_allocate_control_bloc
return -ENOMEM;
 
for (i = 0; i < PMCRAID_MAX_CMD; i++) {
-   pinstance->cmd_list[i]->ioa_cb =
-   dma_pool_alloc(
-   pinstance->control_pool,
-   GFP_KERNEL,
-   &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
+   pinstance->cmd_list[i]->ioa_cb = 
dma_pool_zalloc(pinstance->control_pool,
+GFP_KERNEL,
+
&(pinstance->cmd_list[i]->ioa_cb_bus_addr));
 
if (!pinstance->cmd_list[i]->ioa_cb) {
pmcraid_release_control_blocks(pinstance, i);
return -ENOMEM;
}
-   memset(pinstance->cmd_list[i]->ioa_cb, 0,
-   sizeof(struct pmcraid_control_block));
}
return 0;
 }


Cocci spatch "pool_zalloc-simple" - v5.2-rc1

2019-05-29 Thread Thomas Meyer
Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc

2019-05-29 Thread Thomas Meyer
Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4114,14 +4114,13 @@ lpfc_new_io_buf(struct lpfc_hba *phba, i
 * pci bus space for an I/O. The DMA buffer includes the
 * number of SGE's necessary to support the sg_tablesize.
 */
-   lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
-   GFP_KERNEL,
-   _ncmd->dma_handle);
+   lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
+ GFP_KERNEL,
+ _ncmd->dma_handle);
if (!lpfc_ncmd->data) {
kfree(lpfc_ncmd);
break;
}
-   memset(lpfc_ncmd->data, 0, phba->cfg_sg_dma_buf_size);
 
/*
 * 4K Page alignment is CRITICAL to BlockGuard, double check


Cocci spatch "vma_pages" - v5.2-rc1

2019-05-29 Thread Thomas Meyer
Use vma_pages function on vma object instead of explicit computation.

Found by coccinelle spatch "api/vma_pages.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[PATCH] vfio-pci/nvlink2: Use vma_pages function instead of explicit computation

2019-05-29 Thread Thomas Meyer
Use vma_pages function on vma object instead of explicit computation.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/vfio/pci/vfio_pci_nvlink2.c 
b/drivers/vfio/pci/vfio_pci_nvlink2.c
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -161,7 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vf
 
atomic_inc(>mm->mm_count);
ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
-   (vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
+   vma_pages(vma),
data->gpu_hpa, >mem);
 
trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr,


Cocci spatch "of_table" - v5.2-rc1

2019-05-27 Thread Thomas Meyer
Make sure (of/i2c/platform)_device_id tables are NULL terminated.

Found by coccinelle spatch "misc/of_table.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[no subject]

2019-05-26 Thread Thomas Meyer
>From tho...@m3y3r.de Sun May 26 00:13:26 2019
Subject: [PATCH] vfio-pci/nvlink2: Use vma_pages function instead of explicit
 computation
To: alex.william...@redhat.com, k...@vger.kernel.org, 
linux-kernel@vger.kernel.org
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Patch: Cocci
X-Mailer: DiffSplit
Message-ID: <1558822461341-1674464153-1-diffsplit-tho...@m3y3r.de>
References: <1558822461331-726613767-0-diffsplit-tho...@m3y3r.de>
In-Reply-To: <1558822461331-726613767-0-diffsplit-tho...@m3y3r.de>
X-Serial-No: 1

Use vma_pages function on vma object instead of explicit computation.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/vfio/pci/vfio_pci_nvlink2.c 
b/drivers/vfio/pci/vfio_pci_nvlink2.c
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -161,7 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vf
 
atomic_inc(>mm->mm_count);
ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
-   (vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
+   vma_pages(vma),
data->gpu_hpa, >mem);
 
trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr,


[no subject]

2019-05-26 Thread Thomas Meyer
>From tho...@m3y3r.de Sun May 26 00:14:21 2019
Subject: Cocci spatch "vma_pages" - v5.2-rc1
To: linux-kernel@vger.kernel.org
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Patch: Cocci
X-Mailer: DiffSplit
Message-ID: <1558822461331-726613767-0-diffsplit-tho...@m3y3r.de>

Use vma_pages function on vma object instead of explicit computation.

Found by coccinelle spatch "api/vma_pages.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[no subject]

2019-05-26 Thread Thomas Meyer
>From tho...@m3y3r.de Sun May 26 13:49:24 2019
Subject: Cocci spatch "of_table" - v5.2-rc1
To: linux-kernel@vger.kernel.org
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Patch: Cocci
X-Mailer: DiffSplit
Message-ID: <1558871364605-1026448693-0-diffsplit-tho...@m3y3r.de>

Make sure (of/i2c/platform)_device_id tables are NULL terminated.

Found by coccinelle spatch "misc/of_table.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[no subject]

2019-05-26 Thread Thomas Meyer
>From tho...@m3y3r.de Sun May 26 13:49:04 2019
Subject: [PATCH] drm/omap: Make sure device_id tables are NULL terminated
To: tomi.valkei...@ti.com, airl...@linux.ie, dan...@ffwll.ch,
 dri-de...@lists.freedesktop.org, linux-kernel@vger.kernel.org
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Patch: Cocci
X-Mailer: DiffSplit
Message-ID: <1558871364611-249425076-1-diffsplit-tho...@m3y3r.de>
References: <1558871364605-1026448693-0-diffsplit-tho...@m3y3r.de>
In-Reply-To: <1558871364605-1026448693-0-diffsplit-tho...@m3y3r.de>
X-Serial-No: 1

Make sure (of/i2c/platform)_device_id tables are NULL terminated.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -198,6 +198,7 @@ static const struct of_device_id omapdss
{ .compatible = "toppoly,td028ttec1" },
{ .compatible = "tpo,td028ttec1" },
{ .compatible = "tpo,td043mtea1" },
+   {},
 };
 
 static int __init omapdss_boot_init(void)


uio drivers?

2019-01-10 Thread Thomas Meyer
Hi,

I wanted to have a look at some existing userspace i/o drivers, but
wasn't able to find any. do such drivers exist?
Can anybody point me to some uio drivers with open source code?

with kind regards
thomas


[PATCH] platform/x86: intel_ips: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1300,8 +1300,7 @@ static const struct file_operations ips_
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-   if (ips->debug_root)
-   debugfs_remove_recursive(ips->debug_root);
+   debugfs_remove_recursive(ips->debug_root);
return;
 }
 


[PATCH] platform/x86: intel_ips: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1300,8 +1300,7 @@ static const struct file_operations ips_
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-   if (ips->debug_root)
-   debugfs_remove_recursive(ips->debug_root);
+   debugfs_remove_recursive(ips->debug_root);
return;
 }
 


[PATCH] PM / AVS: SmartReflex: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -1010,8 +1010,7 @@ static int omap_sr_remove(struct platfor
 
if (sr_info->autocomp_active)
sr_stop_vddautocomp(sr_info);
-   if (sr_info->dbg_dir)
-   debugfs_remove_recursive(sr_info->dbg_dir);
+   debugfs_remove_recursive(sr_info->dbg_dir);
 
pm_runtime_disable(>dev);
list_del(_info->node);


[PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1243,8 +1243,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
sg_pci_blk[i].dma_addr);
}
-   if (raid_dev->sg_pool_handle)
-   dma_pool_destroy(raid_dev->sg_pool_handle);
+   dma_pool_destroy(raid_dev->sg_pool_handle);
 
 
epthru_pci_blk = raid_dev->epthru_pool;
@@ -1252,8 +1251,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->epthru_pool_handle,
epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
}
-   if (raid_dev->epthru_pool_handle)
-   dma_pool_destroy(raid_dev->epthru_pool_handle);
+   dma_pool_destroy(raid_dev->epthru_pool_handle);
 
 
mbox_pci_blk = raid_dev->mbox_pool;
@@ -1261,8 +1259,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->mbox_pool_handle,
mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr);
}
-   if (raid_dev->mbox_pool_handle)
-   dma_pool_destroy(raid_dev->mbox_pool_handle);
+   dma_pool_destroy(raid_dev->mbox_pool_handle);
 
return;
 }
diff -u -p a/drivers/scsi/megaraid/megaraid_mm.c 
b/drivers/scsi/megaraid/megaraid_mm.c
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -1017,8 +1017,7 @@ memalloc_error:
kfree(adapter->kioc_list);
kfree(adapter->mbox_list);
 
-   if (adapter->pthru_dma_pool)
-   dma_pool_destroy(adapter->pthru_dma_pool);
+   dma_pool_destroy(adapter->pthru_dma_pool);
 
kfree(adapter);
 
diff -u -p a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_
 
}
 
-   if (fusion->reply_frames_desc_pool)
-   dma_pool_destroy(fusion->reply_frames_desc_pool);
-   if (fusion->reply_frames_desc_pool_align)
-   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
+   dma_pool_destroy(fusion->reply_frames_desc_pool);
+   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
 
if (fusion->rdpq_virt)
dma_free_coherent(>pdev->dev,
@@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas
fusion->reply_frames_desc[0],
fusion->reply_frames_desc_phys[0]);
 
-   if (fusion->reply_frames_desc_pool)
-   dma_pool_destroy(fusion->reply_frames_desc_pool);
+   dma_pool_destroy(fusion->reply_frames_desc_pool);
 
 }
 
@@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init
  fusion->ioc_init_cmd->frame,
  fusion->ioc_init_cmd->frame_phys_addr);
 
-   if (fusion->ioc_init_cmd)
-   kfree(fusion->ioc_init_cmd);
+   kfree(fusion->ioc_init_cmd);
 }
 
 /**


[PATCH] PM / AVS: SmartReflex: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -1010,8 +1010,7 @@ static int omap_sr_remove(struct platfor
 
if (sr_info->autocomp_active)
sr_stop_vddautocomp(sr_info);
-   if (sr_info->dbg_dir)
-   debugfs_remove_recursive(sr_info->dbg_dir);
+   debugfs_remove_recursive(sr_info->dbg_dir);
 
pm_runtime_disable(>dev);
list_del(_info->node);


[PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1243,8 +1243,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
sg_pci_blk[i].dma_addr);
}
-   if (raid_dev->sg_pool_handle)
-   dma_pool_destroy(raid_dev->sg_pool_handle);
+   dma_pool_destroy(raid_dev->sg_pool_handle);
 
 
epthru_pci_blk = raid_dev->epthru_pool;
@@ -1252,8 +1251,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->epthru_pool_handle,
epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
}
-   if (raid_dev->epthru_pool_handle)
-   dma_pool_destroy(raid_dev->epthru_pool_handle);
+   dma_pool_destroy(raid_dev->epthru_pool_handle);
 
 
mbox_pci_blk = raid_dev->mbox_pool;
@@ -1261,8 +1259,7 @@ megaraid_mbox_teardown_dma_pools(adapter
dma_pool_free(raid_dev->mbox_pool_handle,
mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr);
}
-   if (raid_dev->mbox_pool_handle)
-   dma_pool_destroy(raid_dev->mbox_pool_handle);
+   dma_pool_destroy(raid_dev->mbox_pool_handle);
 
return;
 }
diff -u -p a/drivers/scsi/megaraid/megaraid_mm.c 
b/drivers/scsi/megaraid/megaraid_mm.c
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -1017,8 +1017,7 @@ memalloc_error:
kfree(adapter->kioc_list);
kfree(adapter->mbox_list);
 
-   if (adapter->pthru_dma_pool)
-   dma_pool_destroy(adapter->pthru_dma_pool);
+   dma_pool_destroy(adapter->pthru_dma_pool);
 
kfree(adapter);
 
diff -u -p a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_
 
}
 
-   if (fusion->reply_frames_desc_pool)
-   dma_pool_destroy(fusion->reply_frames_desc_pool);
-   if (fusion->reply_frames_desc_pool_align)
-   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
+   dma_pool_destroy(fusion->reply_frames_desc_pool);
+   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
 
if (fusion->rdpq_virt)
dma_free_coherent(>pdev->dev,
@@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas
fusion->reply_frames_desc[0],
fusion->reply_frames_desc_phys[0]);
 
-   if (fusion->reply_frames_desc_pool)
-   dma_pool_destroy(fusion->reply_frames_desc_pool);
+   dma_pool_destroy(fusion->reply_frames_desc_pool);
 
 }
 
@@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init
  fusion->ioc_init_cmd->frame,
  fusion->ioc_init_cmd->frame_phys_addr);
 
-   if (fusion->ioc_init_cmd)
-   kfree(fusion->ioc_init_cmd);
+   kfree(fusion->ioc_init_cmd);
 }
 
 /**


[PATCH] [SCSI] zfcp: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -248,20 +248,13 @@ static int zfcp_allocate_low_mem_buffers
 
 static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
 {
-   if (adapter->pool.erp_req)
-   mempool_destroy(adapter->pool.erp_req);
-   if (adapter->pool.scsi_req)
-   mempool_destroy(adapter->pool.scsi_req);
-   if (adapter->pool.scsi_abort)
-   mempool_destroy(adapter->pool.scsi_abort);
-   if (adapter->pool.qtcb_pool)
-   mempool_destroy(adapter->pool.qtcb_pool);
-   if (adapter->pool.status_read_req)
-   mempool_destroy(adapter->pool.status_read_req);
-   if (adapter->pool.sr_data)
-   mempool_destroy(adapter->pool.sr_data);
-   if (adapter->pool.gid_pn)
-   mempool_destroy(adapter->pool.gid_pn);
+   mempool_destroy(adapter->pool.erp_req);
+   mempool_destroy(adapter->pool.scsi_req);
+   mempool_destroy(adapter->pool.scsi_abort);
+   mempool_destroy(adapter->pool.qtcb_pool);
+   mempool_destroy(adapter->pool.status_read_req);
+   mempool_destroy(adapter->pool.sr_data);
+   mempool_destroy(adapter->pool.gid_pn);
 }
 
 /**


[PATCH] drm/amdgpu: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -816,6 +816,5 @@ out:
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
unregister_acpi_notifier(>acpi_nb);
-   if (adev->atif)
-   kfree(adev->atif);
+   kfree(adev->atif);
 }


[PATCH] [SCSI] zfcp: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -248,20 +248,13 @@ static int zfcp_allocate_low_mem_buffers
 
 static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
 {
-   if (adapter->pool.erp_req)
-   mempool_destroy(adapter->pool.erp_req);
-   if (adapter->pool.scsi_req)
-   mempool_destroy(adapter->pool.scsi_req);
-   if (adapter->pool.scsi_abort)
-   mempool_destroy(adapter->pool.scsi_abort);
-   if (adapter->pool.qtcb_pool)
-   mempool_destroy(adapter->pool.qtcb_pool);
-   if (adapter->pool.status_read_req)
-   mempool_destroy(adapter->pool.status_read_req);
-   if (adapter->pool.sr_data)
-   mempool_destroy(adapter->pool.sr_data);
-   if (adapter->pool.gid_pn)
-   mempool_destroy(adapter->pool.gid_pn);
+   mempool_destroy(adapter->pool.erp_req);
+   mempool_destroy(adapter->pool.scsi_req);
+   mempool_destroy(adapter->pool.scsi_abort);
+   mempool_destroy(adapter->pool.qtcb_pool);
+   mempool_destroy(adapter->pool.status_read_req);
+   mempool_destroy(adapter->pool.sr_data);
+   mempool_destroy(adapter->pool.gid_pn);
 }
 
 /**


[PATCH] drm/amdgpu: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -816,6 +816,5 @@ out:
 void amdgpu_acpi_fini(struct amdgpu_device *adev)
 {
unregister_acpi_notifier(>acpi_nb);
-   if (adev->atif)
-   kfree(adev->atif);
+   kfree(adev->atif);
 }


Cocci spatch "ifnullfree" - v4.20-rc4

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Found by coccinelle spatch "free/ifnullfree.cocci"

Run against version v4.20-rc4

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4191,12 +4191,10 @@ fail_free_nvram:
kfree(ha->nvram);
ha->nvram = NULL;
 fail_free_ctx_mempool:
-   if (ha->ctx_mempool)
-   mempool_destroy(ha->ctx_mempool);
+   mempool_destroy(ha->ctx_mempool);
ha->ctx_mempool = NULL;
 fail_free_srb_mempool:
-   if (ha->srb_mempool)
-   mempool_destroy(ha->srb_mempool);
+   mempool_destroy(ha->srb_mempool);
ha->srb_mempool = NULL;
 fail_free_gid_list:
dma_free_coherent(>pdev->dev, qla2x00_gid_list_size(ha),
@@ -4498,8 +4496,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
dma_free_coherent(>pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump,
ha->mctp_dump_dma);
 
-   if (ha->srb_mempool)
-   mempool_destroy(ha->srb_mempool);
+   mempool_destroy(ha->srb_mempool);
 
if (ha->dcbx_tlv)
dma_free_coherent(>pdev->dev, DCBX_TLV_DATA_SIZE,
@@ -4531,8 +4528,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->async_pd)
dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
 
-   if (ha->s_dma_pool)
-   dma_pool_destroy(ha->s_dma_pool);
+   dma_pool_destroy(ha->s_dma_pool);
 
if (ha->gid_list)
dma_free_coherent(>pdev->dev, qla2x00_gid_list_size(ha),
@@ -4553,14 +4549,11 @@ qla2x00_mem_free(struct qla_hw_data *ha)
}
}
 
-   if (ha->dl_dma_pool)
-   dma_pool_destroy(ha->dl_dma_pool);
+   dma_pool_destroy(ha->dl_dma_pool);
 
-   if (ha->fcp_cmnd_dma_pool)
-   dma_pool_destroy(ha->fcp_cmnd_dma_pool);
+   dma_pool_destroy(ha->fcp_cmnd_dma_pool);
 
-   if (ha->ctx_mempool)
-   mempool_destroy(ha->ctx_mempool);
+   mempool_destroy(ha->ctx_mempool);
 
qlt_mem_free(ha);
 
@@ -7106,8 +7099,7 @@ qla2x00_module_exit(void)
qla2x00_release_firmware();
kmem_cache_destroy(srb_cachep);
qlt_exit();
-   if (ctx_cachep)
-   kmem_cache_destroy(ctx_cachep);
+   kmem_cache_destroy(ctx_cachep);
fc_release_transport(qla2xxx_transport_template);
fc_release_transport(qla2xxx_transport_vport_template);
 }


Cocci spatch "ifnullfree" - v4.20-rc4

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Found by coccinelle spatch "free/ifnullfree.cocci"

Run against version v4.20-rc4

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[PATCH] scsi: qla2xxx: NULL check before some freeing functions is not needed.

2018-12-02 Thread Thomas Meyer
NULL check before some freeing functions is not needed.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4191,12 +4191,10 @@ fail_free_nvram:
kfree(ha->nvram);
ha->nvram = NULL;
 fail_free_ctx_mempool:
-   if (ha->ctx_mempool)
-   mempool_destroy(ha->ctx_mempool);
+   mempool_destroy(ha->ctx_mempool);
ha->ctx_mempool = NULL;
 fail_free_srb_mempool:
-   if (ha->srb_mempool)
-   mempool_destroy(ha->srb_mempool);
+   mempool_destroy(ha->srb_mempool);
ha->srb_mempool = NULL;
 fail_free_gid_list:
dma_free_coherent(>pdev->dev, qla2x00_gid_list_size(ha),
@@ -4498,8 +4496,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
dma_free_coherent(>pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump,
ha->mctp_dump_dma);
 
-   if (ha->srb_mempool)
-   mempool_destroy(ha->srb_mempool);
+   mempool_destroy(ha->srb_mempool);
 
if (ha->dcbx_tlv)
dma_free_coherent(>pdev->dev, DCBX_TLV_DATA_SIZE,
@@ -4531,8 +4528,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->async_pd)
dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
 
-   if (ha->s_dma_pool)
-   dma_pool_destroy(ha->s_dma_pool);
+   dma_pool_destroy(ha->s_dma_pool);
 
if (ha->gid_list)
dma_free_coherent(>pdev->dev, qla2x00_gid_list_size(ha),
@@ -4553,14 +4549,11 @@ qla2x00_mem_free(struct qla_hw_data *ha)
}
}
 
-   if (ha->dl_dma_pool)
-   dma_pool_destroy(ha->dl_dma_pool);
+   dma_pool_destroy(ha->dl_dma_pool);
 
-   if (ha->fcp_cmnd_dma_pool)
-   dma_pool_destroy(ha->fcp_cmnd_dma_pool);
+   dma_pool_destroy(ha->fcp_cmnd_dma_pool);
 
-   if (ha->ctx_mempool)
-   mempool_destroy(ha->ctx_mempool);
+   mempool_destroy(ha->ctx_mempool);
 
qlt_mem_free(ha);
 
@@ -7106,8 +7099,7 @@ qla2x00_module_exit(void)
qla2x00_release_firmware();
kmem_cache_destroy(srb_cachep);
qlt_exit();
-   if (ctx_cachep)
-   kmem_cache_destroy(ctx_cachep);
+   kmem_cache_destroy(ctx_cachep);
fc_release_transport(qla2xxx_transport_template);
fc_release_transport(qla2xxx_transport_vport_template);
 }


sky2: no irq handler on v4.17.6

2018-07-22 Thread Thomas Meyer
Hi,

I currently use my old i386 laptop with kernel v4.14.55 where my sky2
ethernet driver works correctly.

I tried to upgrade to v4.17.6 but the sky2 driver fails with "No irq
handler for vector".

any ideas?

dmesg:

[0.00] Linux version 4.17.6+ (thomas@computer) (gcc version 8.1.1 
20180502 (Red Hat 8.1.1-1) (GCC)) #2 SMP Sat Jul 21 09:14:49 CEST 2018
[0.00] Disabled fast string operations
[0.00] x86/fpu: x87 FPU will use FXSAVE
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0008efff] usable
[0.00] BIOS-e820: [mem 0x0008f000-0x0008] ACPI NVS
[0.00] BIOS-e820: [mem 0x0009-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x7f0c7fff] usable
[0.00] BIOS-e820: [mem 0x7f0c8000-0x7f2c8fff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7f2c9000-0x7fe4afff] usable
[0.00] BIOS-e820: [mem 0x7fe4b000-0x7fe6efff] reserved
[0.00] BIOS-e820: [mem 0x7fe6f000-0x7fe7efff] usable
[0.00] BIOS-e820: [mem 0x7fe7f000-0x7feaafff] reserved
[0.00] BIOS-e820: [mem 0x7feab000-0x7feb1fff] usable
[0.00] BIOS-e820: [mem 0x7feb2000-0x7feb6fff] ACPI data
[0.00] BIOS-e820: [mem 0x7feb7000-0x7feb8fff] usable
[0.00] BIOS-e820: [mem 0x7feb9000-0x7feeefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7feef000-0x7fefefff] ACPI data
[0.00] BIOS-e820: [mem 0x7feff000-0x7fef] reserved
[0.00] BIOS-e820: [mem 0xe00f8000-0xe00f8fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfffb-0xfffd] reserved
[0.00] Notice: NX (Execute Disable) protection cannot be enabled: 
non-PAE kernel!
[0.00] e820: update [mem 0x7c2a9010-0x7c2b8a3b] usable ==> usable
[0.00] e820: update [mem 0x7c2a9010-0x7c2b8a3b] usable ==> usable
[0.00] extended physical RAM map:
[0.00] reserve setup_data: [mem 0x-0x0008efff] 
usable
[0.00] reserve setup_data: [mem 0x0008f000-0x0008] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x0009-0x0009] 
usable
[0.00] reserve setup_data: [mem 0x0010-0x7c2a900f] 
usable
[0.00] reserve setup_data: [mem 0x7c2a9010-0x7c2b8a3b] 
usable
[0.00] reserve setup_data: [mem 0x7c2b8a3c-0x7f0c7fff] 
usable
[0.00] reserve setup_data: [mem 0x7f0c8000-0x7f2c8fff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7f2c9000-0x7fe4afff] 
usable
[0.00] reserve setup_data: [mem 0x7fe4b000-0x7fe6efff] 
reserved
[0.00] reserve setup_data: [mem 0x7fe6f000-0x7fe7efff] 
usable
[0.00] reserve setup_data: [mem 0x7fe7f000-0x7feaafff] 
reserved
[0.00] reserve setup_data: [mem 0x7feab000-0x7feb1fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb2000-0x7feb6fff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feb7000-0x7feb8fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb9000-0x7feeefff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7feef000-0x7fefefff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feff000-0x7fef] 
reserved
[0.00] reserve setup_data: [mem 0xe00f8000-0xe00f8fff] 
reserved
[0.00] reserve setup_data: [mem 0xfed1c000-0xfed1] 
reserved
[0.00] reserve setup_data: [mem 0xfffb-0xfffd] 
reserved
[0.00] efi: EFI v1.10 by Apple
[0.00] efi:  ACPI=0x7fefd000  ACPI 2.0=0x7fefd014  SMBIOS=0x7feba000 
[0.00] SMBIOS 2.4 present.
[0.00] DMI: Apple Computer, Inc. MacBookPro1,1/Mac-F425BEC8, BIOS
MBP11.88Z.0055.B08.0610121325 10/12/06
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x7feb9 max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-C write-protect
[0.00]   D-D uncachable
[0.00]   E-F write-protect
[0.00] MTRR variable ranges enabled:
[0.00]   0 base 0FFE0 mask FFFE0 write-protect
[0.00]   1 base 0 mask F8000 write-back
[0.00]   2 base 07FF0 mask 0 uncachable
[0.00]   3 disabled
[

sky2: no irq handler on v4.17.6

2018-07-22 Thread Thomas Meyer
Hi,

I currently use my old i386 laptop with kernel v4.14.55 where my sky2
ethernet driver works correctly.

I tried to upgrade to v4.17.6 but the sky2 driver fails with "No irq
handler for vector".

any ideas?

dmesg:

[0.00] Linux version 4.17.6+ (thomas@computer) (gcc version 8.1.1 
20180502 (Red Hat 8.1.1-1) (GCC)) #2 SMP Sat Jul 21 09:14:49 CEST 2018
[0.00] Disabled fast string operations
[0.00] x86/fpu: x87 FPU will use FXSAVE
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0008efff] usable
[0.00] BIOS-e820: [mem 0x0008f000-0x0008] ACPI NVS
[0.00] BIOS-e820: [mem 0x0009-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x7f0c7fff] usable
[0.00] BIOS-e820: [mem 0x7f0c8000-0x7f2c8fff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7f2c9000-0x7fe4afff] usable
[0.00] BIOS-e820: [mem 0x7fe4b000-0x7fe6efff] reserved
[0.00] BIOS-e820: [mem 0x7fe6f000-0x7fe7efff] usable
[0.00] BIOS-e820: [mem 0x7fe7f000-0x7feaafff] reserved
[0.00] BIOS-e820: [mem 0x7feab000-0x7feb1fff] usable
[0.00] BIOS-e820: [mem 0x7feb2000-0x7feb6fff] ACPI data
[0.00] BIOS-e820: [mem 0x7feb7000-0x7feb8fff] usable
[0.00] BIOS-e820: [mem 0x7feb9000-0x7feeefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7feef000-0x7fefefff] ACPI data
[0.00] BIOS-e820: [mem 0x7feff000-0x7fef] reserved
[0.00] BIOS-e820: [mem 0xe00f8000-0xe00f8fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfffb-0xfffd] reserved
[0.00] Notice: NX (Execute Disable) protection cannot be enabled: 
non-PAE kernel!
[0.00] e820: update [mem 0x7c2a9010-0x7c2b8a3b] usable ==> usable
[0.00] e820: update [mem 0x7c2a9010-0x7c2b8a3b] usable ==> usable
[0.00] extended physical RAM map:
[0.00] reserve setup_data: [mem 0x-0x0008efff] 
usable
[0.00] reserve setup_data: [mem 0x0008f000-0x0008] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x0009-0x0009] 
usable
[0.00] reserve setup_data: [mem 0x0010-0x7c2a900f] 
usable
[0.00] reserve setup_data: [mem 0x7c2a9010-0x7c2b8a3b] 
usable
[0.00] reserve setup_data: [mem 0x7c2b8a3c-0x7f0c7fff] 
usable
[0.00] reserve setup_data: [mem 0x7f0c8000-0x7f2c8fff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7f2c9000-0x7fe4afff] 
usable
[0.00] reserve setup_data: [mem 0x7fe4b000-0x7fe6efff] 
reserved
[0.00] reserve setup_data: [mem 0x7fe6f000-0x7fe7efff] 
usable
[0.00] reserve setup_data: [mem 0x7fe7f000-0x7feaafff] 
reserved
[0.00] reserve setup_data: [mem 0x7feab000-0x7feb1fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb2000-0x7feb6fff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feb7000-0x7feb8fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb9000-0x7feeefff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7feef000-0x7fefefff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feff000-0x7fef] 
reserved
[0.00] reserve setup_data: [mem 0xe00f8000-0xe00f8fff] 
reserved
[0.00] reserve setup_data: [mem 0xfed1c000-0xfed1] 
reserved
[0.00] reserve setup_data: [mem 0xfffb-0xfffd] 
reserved
[0.00] efi: EFI v1.10 by Apple
[0.00] efi:  ACPI=0x7fefd000  ACPI 2.0=0x7fefd014  SMBIOS=0x7feba000 
[0.00] SMBIOS 2.4 present.
[0.00] DMI: Apple Computer, Inc. MacBookPro1,1/Mac-F425BEC8, BIOS
MBP11.88Z.0055.B08.0610121325 10/12/06
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x7feb9 max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-C write-protect
[0.00]   D-D uncachable
[0.00]   E-F write-protect
[0.00] MTRR variable ranges enabled:
[0.00]   0 base 0FFE0 mask FFFE0 write-protect
[0.00]   1 base 0 mask F8000 write-back
[0.00]   2 base 07FF0 mask 0 uncachable
[0.00]   3 disabled
[

Re: [PATCH] auxdisplay: img-ascii-lcd: Only build on archs that have IOMEM

2017-11-27 Thread Thomas Meyer
On Thu, Aug 10, 2017 at 11:24:04AM -0700, Randy Dunlap wrote:
> On 08/10/2017 01:53 AM, Thomas Meyer wrote:
> > This avoids the MODPOST error:
> > ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] 
> > undefined!
> > 
> > Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
> > ---
> >  drivers/auxdisplay/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> > index 9ae6681c90ad..9088c66e4c08 100644
> > --- a/drivers/auxdisplay/Kconfig
> > +++ b/drivers/auxdisplay/Kconfig
> > @@ -135,6 +135,7 @@ config CFAG12864B_RATE
> >  
> >  config IMG_ASCII_LCD
> > tristate "Imagination Technologies ASCII LCD Display"
> > +   depends on HAS_IOMEM
> > default y if MIPS_MALTA || MIPS_SEAD3
> > select SYSCON
> > help
> > 
> 
> I posted the same patch on 2017-JAN-01, so I agree with it.
> 
> https://lkml.org/lkml/2017/1/1/87
> 
> Acked-by: Randy Dunlap <rdun...@infradead.org>

No response from the maintainer yet. I think this driver is actually 
unmaintained.
What to do now?

> 
> -- 
> ~Randy


Re: [PATCH] auxdisplay: img-ascii-lcd: Only build on archs that have IOMEM

2017-11-27 Thread Thomas Meyer
On Thu, Aug 10, 2017 at 11:24:04AM -0700, Randy Dunlap wrote:
> On 08/10/2017 01:53 AM, Thomas Meyer wrote:
> > This avoids the MODPOST error:
> > ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] 
> > undefined!
> > 
> > Signed-off-by: Thomas Meyer 
> > ---
> >  drivers/auxdisplay/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
> > index 9ae6681c90ad..9088c66e4c08 100644
> > --- a/drivers/auxdisplay/Kconfig
> > +++ b/drivers/auxdisplay/Kconfig
> > @@ -135,6 +135,7 @@ config CFAG12864B_RATE
> >  
> >  config IMG_ASCII_LCD
> > tristate "Imagination Technologies ASCII LCD Display"
> > +   depends on HAS_IOMEM
> > default y if MIPS_MALTA || MIPS_SEAD3
> > select SYSCON
> > help
> > 
> 
> I posted the same patch on 2017-JAN-01, so I agree with it.
> 
> https://lkml.org/lkml/2017/1/1/87
> 
> Acked-by: Randy Dunlap 

No response from the maintainer yet. I think this driver is actually 
unmaintained.
What to do now?

> 
> -- 
> ~Randy


of: unittest fails on UML

2017-10-13 Thread Thomas Meyer
Hi,

drivers/of/unittest.c fails on UML with a kernel crash.
The crash is due to of_find_device_by_node() returning NULL:

841│ /* Test that a missing irq domain returns -EPROBE_DEFER */
842│ np = of_find_node_by_path("/testcase-data/testcase-device1");
843├>pdev = of_find_device_by_node(np);
844│ unittest(pdev, "device 1 creation failed\n");
845│
846│ irq = platform_get_irq(pdev, 0);
847│ unittest(irq == -EPROBE_DEFER, "device deferred probe failed - 
%d\n", irq);

in line 846 platform_get_irq is called with NULL.

This helps to get through unittest.c:

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d1bd99271066..a3b3d0ec8818 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -86,6 +86,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+   if (!dev)
+   return -ENXIO;
+
 #ifdef CONFIG_SPARC
/* sparc does not have irqs represented as IORESOURCE_IRQ resources */
if (!dev || num >= dev->archdata.num_irqs)

log extract:

[   24.85] kobject: 'fragment@0' (6c818aa8): kobject_add_internal: 
parent: 'overlay4', set: 'devicetree'
[   24.85] ### dt-test ### start of unittest - you will see error messages
[   24.85] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] kobject: 'n1' (6cefca50): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n2' (6cefde30): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_add_internal: parent: 
'n2', set: 'devicetree'
[   24.86] kobject: 'node-remove' (6c800880): kobject_add_internal: 
parent: 'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_release, parent   
(null) (delayed 400)
[   24.86] kobject: 'n2' (6cefde30): kobject_release, parent
   (null) (delayed 100)
[   24.86] kobject: 'n1' (6cefca50): kobject_release, parent
   (null) (delayed 300)
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():844 device 
1 creation failed
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():847 device 
deferred probe failed - -6
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():852 device 
2 creation failed
[   24.86] Registering platform device 'unittest-bus.0'. Parent at platform
[   24.86] device: 'unittest-bus.0': device_add
[   24.86] kobject: 'unittest-bus.0' (6cf11568): 
kobject_add_internal: parent: 'platform', set: 'devices'
[   24.86] bus: 'platform': add device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] bus: 'platform': remove device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_release, 
parent   (null) (delayed 100)
[   24.86] bus: 'platform': add driver unittest
[   24.86] kobject: 'unittest' (6c86bba8): kobject_add_internal: 
parent: 'drivers', set: 'drivers'
[   24.87] kobject: 'unittest' (6c86bba8): kobject_uevent_env
[   24.87] kobject: 'unittest' (6c86bba8): fill_kobj_path: path = 
'/bus/platform/drivers/unittest'
[   24.87] ### dt-test ### FAIL of_unittest_overlay():1944 could not 
populate bus @ "/testcase-data/overlay-node/test-bus"
[   24.87] ### dt-test ### FAIL of_unittest_overlay_high_level():2201 
overlay_base_root not initialized
[   24.87] ### dt-test ### end of unittest - 163 passed, 7 failed

so any idea what is going on here?
any help is appreciated.

with kind regards
thomas


of: unittest fails on UML

2017-10-13 Thread Thomas Meyer
Hi,

drivers/of/unittest.c fails on UML with a kernel crash.
The crash is due to of_find_device_by_node() returning NULL:

841│ /* Test that a missing irq domain returns -EPROBE_DEFER */
842│ np = of_find_node_by_path("/testcase-data/testcase-device1");
843├>pdev = of_find_device_by_node(np);
844│ unittest(pdev, "device 1 creation failed\n");
845│
846│ irq = platform_get_irq(pdev, 0);
847│ unittest(irq == -EPROBE_DEFER, "device deferred probe failed - 
%d\n", irq);

in line 846 platform_get_irq is called with NULL.

This helps to get through unittest.c:

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d1bd99271066..a3b3d0ec8818 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -86,6 +86,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+   if (!dev)
+   return -ENXIO;
+
 #ifdef CONFIG_SPARC
/* sparc does not have irqs represented as IORESOURCE_IRQ resources */
if (!dev || num >= dev->archdata.num_irqs)

log extract:

[   24.85] kobject: 'fragment@0' (6c818aa8): kobject_add_internal: 
parent: 'overlay4', set: 'devicetree'
[   24.85] ### dt-test ### start of unittest - you will see error messages
[   24.85] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] kobject: 'n1' (6cefca50): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n2' (6cefde30): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_add_internal: parent: 
'n2', set: 'devicetree'
[   24.86] kobject: 'node-remove' (6c800880): kobject_add_internal: 
parent: 'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_release, parent   
(null) (delayed 400)
[   24.86] kobject: 'n2' (6cefde30): kobject_release, parent
   (null) (delayed 100)
[   24.86] kobject: 'n1' (6cefca50): kobject_release, parent
   (null) (delayed 300)
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():844 device 
1 creation failed
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():847 device 
deferred probe failed - -6
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():852 device 
2 creation failed
[   24.86] Registering platform device 'unittest-bus.0'. Parent at platform
[   24.86] device: 'unittest-bus.0': device_add
[   24.86] kobject: 'unittest-bus.0' (6cf11568): 
kobject_add_internal: parent: 'platform', set: 'devices'
[   24.86] bus: 'platform': add device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] bus: 'platform': remove device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_release, 
parent   (null) (delayed 100)
[   24.86] bus: 'platform': add driver unittest
[   24.86] kobject: 'unittest' (6c86bba8): kobject_add_internal: 
parent: 'drivers', set: 'drivers'
[   24.87] kobject: 'unittest' (6c86bba8): kobject_uevent_env
[   24.87] kobject: 'unittest' (6c86bba8): fill_kobj_path: path = 
'/bus/platform/drivers/unittest'
[   24.87] ### dt-test ### FAIL of_unittest_overlay():1944 could not 
populate bus @ "/testcase-data/overlay-node/test-bus"
[   24.87] ### dt-test ### FAIL of_unittest_overlay_high_level():2201 
overlay_base_root not initialized
[   24.87] ### dt-test ### end of unittest - 163 passed, 7 failed

so any idea what is going on here?
any help is appreciated.

with kind regards
thomas


of/unittest fails on UML

2017-10-13 Thread Thomas Meyer
Hi,

drivers/of/unittest.c fails on UML with a kernel crash.
The crash is due to of_find_device_by_node() returning NULL:

841│ /* Test that a missing irq domain returns -EPROBE_DEFER */
842│ np = of_find_node_by_path("/testcase-data/testcase-device1");
843├>pdev = of_find_device_by_node(np);
844│ unittest(pdev, "device 1 creation failed\n");
845│
846│ irq = platform_get_irq(pdev, 0);
847│ unittest(irq == -EPROBE_DEFER, "device deferred probe failed - 
%d\n", irq);

in line 846 platform_get_irq is called with NULL.

This helps to get through unittest.c:

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d1bd99271066..a3b3d0ec8818 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -86,6 +86,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+   if (!dev)
+   return -ENXIO;
+
 #ifdef CONFIG_SPARC
/* sparc does not have irqs represented as IORESOURCE_IRQ resources */
if (!dev || num >= dev->archdata.num_irqs)

log extract:

[   24.85] kobject: 'fragment@0' (6c818aa8): kobject_add_internal: 
parent: 'overlay4', set: 'devicetree'
[   24.85] ### dt-test ### start of unittest - you will see error messages
[   24.85] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] kobject: 'n1' (6cefca50): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n2' (6cefde30): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_add_internal: parent: 
'n2', set: 'devicetree'
[   24.86] kobject: 'node-remove' (6c800880): kobject_add_internal: 
parent: 'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_release, parent   
(null) (delayed 400)
[   24.86] kobject: 'n2' (6cefde30): kobject_release, parent
   (null) (delayed 100)
[   24.86] kobject: 'n1' (6cefca50): kobject_release, parent
   (null) (delayed 300)
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():844 device 
1 creation failed
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():847 device 
deferred probe failed - -6
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():852 device 
2 creation failed
[   24.86] Registering platform device 'unittest-bus.0'. Parent at platform
[   24.86] device: 'unittest-bus.0': device_add
[   24.86] kobject: 'unittest-bus.0' (6cf11568): 
kobject_add_internal: parent: 'platform', set: 'devices'
[   24.86] bus: 'platform': add device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] bus: 'platform': remove device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_release, 
parent   (null) (delayed 100)
[   24.86] bus: 'platform': add driver unittest
[   24.86] kobject: 'unittest' (6c86bba8): kobject_add_internal: 
parent: 'drivers', set: 'drivers'
[   24.87] kobject: 'unittest' (6c86bba8): kobject_uevent_env
[   24.87] kobject: 'unittest' (6c86bba8): fill_kobj_path: path = 
'/bus/platform/drivers/unittest'
[   24.87] ### dt-test ### FAIL of_unittest_overlay():1944 could not 
populate bus @ "/testcase-data/overlay-node/test-bus"
[   24.87] ### dt-test ### FAIL of_unittest_overlay_high_level():2201 
overlay_base_root not initialized
[   24.87] ### dt-test ### end of unittest - 163 passed, 7 failed

so any idea what is going on here?
any help is appreciated.

with kind regards
thomas


of/unittest fails on UML

2017-10-13 Thread Thomas Meyer
Hi,

drivers/of/unittest.c fails on UML with a kernel crash.
The crash is due to of_find_device_by_node() returning NULL:

841│ /* Test that a missing irq domain returns -EPROBE_DEFER */
842│ np = of_find_node_by_path("/testcase-data/testcase-device1");
843├>pdev = of_find_device_by_node(np);
844│ unittest(pdev, "device 1 creation failed\n");
845│
846│ irq = platform_get_irq(pdev, 0);
847│ unittest(irq == -EPROBE_DEFER, "device deferred probe failed - 
%d\n", irq);

in line 846 platform_get_irq is called with NULL.

This helps to get through unittest.c:

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d1bd99271066..a3b3d0ec8818 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -86,6 +86,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+   if (!dev)
+   return -ENXIO;
+
 #ifdef CONFIG_SPARC
/* sparc does not have irqs represented as IORESOURCE_IRQ resources */
if (!dev || num >= dev->archdata.num_irqs)

log extract:

[   24.85] kobject: 'fragment@0' (6c818aa8): kobject_add_internal: 
parent: 'overlay4', set: 'devicetree'
[   24.85] ### dt-test ### start of unittest - you will see error messages
[   24.85] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not get 
#phandle-cells-missing for /testcase-data/phandle-tests/provider1
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: could not find 
phandle
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] OF: /testcase-data/phandle-tests/consumer-a: arguments longer 
than property
[   24.86] kobject: 'n1' (6cefca50): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n2' (6cefde30): kobject_add_internal: parent: 
'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_add_internal: parent: 
'n2', set: 'devicetree'
[   24.86] kobject: 'node-remove' (6c800880): kobject_add_internal: 
parent: 'changeset', set: 'devicetree'
[   24.86] kobject: 'n21' (6cefcda0): kobject_release, parent   
(null) (delayed 400)
[   24.86] kobject: 'n2' (6cefde30): kobject_release, parent
   (null) (delayed 100)
[   24.86] kobject: 'n1' (6cefca50): kobject_release, parent
   (null) (delayed 300)
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():844 device 
1 creation failed
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():847 device 
deferred probe failed - -6
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():852 device 
2 creation failed
[   24.86] Registering platform device 'unittest-bus.0'. Parent at platform
[   24.86] device: 'unittest-bus.0': device_add
[   24.86] kobject: 'unittest-bus.0' (6cf11568): 
kobject_add_internal: parent: 'platform', set: 'devices'
[   24.86] bus: 'platform': add device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] ### dt-test ### FAIL of_unittest_platform_populate():882 Could 
not create device for node 'dev'
[   24.86] bus: 'platform': remove device unittest-bus.0
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_uevent_env
[   24.86] kobject: 'unittest-bus.0' (6cf11568): fill_kobj_path: 
path = '/devices/platform/unittest-bus.0'
[   24.86] kobject: 'unittest-bus.0' (6cf11568): kobject_release, 
parent   (null) (delayed 100)
[   24.86] bus: 'platform': add driver unittest
[   24.86] kobject: 'unittest' (6c86bba8): kobject_add_internal: 
parent: 'drivers', set: 'drivers'
[   24.87] kobject: 'unittest' (6c86bba8): kobject_uevent_env
[   24.87] kobject: 'unittest' (6c86bba8): fill_kobj_path: path = 
'/bus/platform/drivers/unittest'
[   24.87] ### dt-test ### FAIL of_unittest_overlay():1944 could not 
populate bus @ "/testcase-data/overlay-node/test-bus"
[   24.87] ### dt-test ### FAIL of_unittest_overlay_high_level():2201 
overlay_base_root not initialized
[   24.87] ### dt-test ### end of unittest - 163 passed, 7 failed

so any idea what is going on here?
any help is appreciated.

with kind regards
thomas


[PATCH] um: Fix kcov crash before kernel is started.

2017-10-13 Thread Thomas Meyer
UMLs current_thread_info() unconditionally assumes that the top of the stack
contains the thread_info structure.
Prevent kcov from using invalid curent_thread_info() data by disable
instrumentation of early startup code.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---
 arch/um/kernel/skas/Makefile | 2 ++
 lib/Makefile | 4 
 2 files changed, 6 insertions(+)

diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index 0b76d8869c94..df3aedb974a2 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -3,6 +3,8 @@
 # Licensed under the GPL
 #
 
+KCOV_INSTRUMENT:= n
+
 obj-y := clone.o mmu.o process.o syscall.o uaccess.o
 
 # clone.o is in the stub, so it can't be built with profiling
diff --git a/lib/Makefile b/lib/Makefile
index dafa79613fb4..18319ad5daab 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -16,6 +16,10 @@ KCOV_INSTRUMENT_list_debug.o := n
 KCOV_INSTRUMENT_debugobjects.o := n
 KCOV_INSTRUMENT_dynamic_debug.o := n
 
+ifdef CONFIG_UML
+KCOV_INSTRUMENT_cmdline.o := n
+endif
+
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
 rbtree.o radix-tree.o dump_stack.o timerqueue.o\
 idr.o int_sqrt.o extable.o \
-- 
2.11.0



[PATCH] um: Fix kcov crash before kernel is started.

2017-10-13 Thread Thomas Meyer
UMLs current_thread_info() unconditionally assumes that the top of the stack
contains the thread_info structure.
Prevent kcov from using invalid curent_thread_info() data by disable
instrumentation of early startup code.

Signed-off-by: Thomas Meyer 
---
 arch/um/kernel/skas/Makefile | 2 ++
 lib/Makefile | 4 
 2 files changed, 6 insertions(+)

diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index 0b76d8869c94..df3aedb974a2 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -3,6 +3,8 @@
 # Licensed under the GPL
 #
 
+KCOV_INSTRUMENT:= n
+
 obj-y := clone.o mmu.o process.o syscall.o uaccess.o
 
 # clone.o is in the stub, so it can't be built with profiling
diff --git a/lib/Makefile b/lib/Makefile
index dafa79613fb4..18319ad5daab 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -16,6 +16,10 @@ KCOV_INSTRUMENT_list_debug.o := n
 KCOV_INSTRUMENT_debugobjects.o := n
 KCOV_INSTRUMENT_dynamic_debug.o := n
 
+ifdef CONFIG_UML
+KCOV_INSTRUMENT_cmdline.o := n
+endif
+
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
 rbtree.o radix-tree.o dump_stack.o timerqueue.o\
 idr.o int_sqrt.o extable.o \
-- 
2.11.0



Re: [tho...@m3y3r.de: Re: [PATCH] um: Fix kcov crash before kernel is started.]

2017-10-09 Thread Thomas Meyer
On Mon, Oct 09, 2017 at 08:10:45PM +0200, Dmitry Vyukov wrote:
> On Mon, Oct 9, 2017 at 6:47 PM, Thomas Meyer <tho...@m3y3r.de> wrote:
> > - Forwarded message from Thomas Meyer <tho...@m3y3r.de> -
> >
> > Hi,
> >
> > are you able to shed light on this topic?
> > Any help is greatly appreciated!
> >
> > With kind regards
> > thomas
> >
> > Date: Sun, 8 Oct 2017 13:18:24 +0200
> > From: Thomas Meyer <tho...@m3y3r.de>
> > To: Richard Weinberger <rich...@nod.at>
> > Cc: user-mode-linux-de...@lists.sourceforge.net, 
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH] um: Fix kcov crash before kernel is started.
> > User-Agent: NeoMutt/20170113 (1.7.2)
> >
> > On Sun, Oct 08, 2017 at 12:44:12PM +0200, Richard Weinberger wrote:
> >> Am Sonntag, 8. Oktober 2017, 12:31:58 CEST schrieb Thomas Meyer:
> >> > UMLs current_thread_info() unconditionally assumes that the top of the 
> >> > stack
> >> > contains the thread_info structure. But on UML the 
> >> > __sanitizer_cov_trace_pc
> >> > function is called for *all* functions! This results in an early crash:
> >> >
> >> > Prevent kcov from using invalid curent_thread_info() data by checking
> >> > the system_state.
> >> >
> >> > Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
> >> > ---
> >> >  kernel/kcov.c | 6 ++
> >> >  1 file changed, 6 insertions(+)
> >> >
> >> > diff --git a/kernel/kcov.c b/kernel/kcov.c
> >> > index 3f693a0f6f3e..d601c0e956f6 100644
> >> > --- a/kernel/kcov.c
> >> > +++ b/kernel/kcov.c
> >> > @@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
> >> > struct task_struct *t;
> >> > enum kcov_mode mode;
> >> >
> >> > +#ifdef CONFIG_UML
> >> > +   if(!(system_state == SYSTEM_SCHEDULING ||
> >> > +system_state == SYSTEM_RUNNING))
> >> > +   return;
> >> > +#endif
> >>
> >> Hmm, and why does it work on all other archs then?
> >
> > Hi,
> >
> > I guess UML is different then other archs! But to be honest I'm not sure
> > why. I assume that __sanitizer_cov_trace_pc on other archs isn't called
> > that early, or that curent_thread_info returns NULL on other archs when
> > the first task isn't running yet.
> >
> > But as I fail to use/setup the qemu gdb attachment to debug early x86_64 
> > code
> > I can't say exactly why.
> >
> > Maybe someone how knows the inner workings of x86_64 and/or kcov can
> > answer this question!
> 
> 
> Hi,

Hi,

> Yes, kcov can have some issues with early bootstrap code, because it
> accesses current and it can also conflict with say, per-cpu setup code
> (at least it was the case for x86). For x86 and arm64 we just bulk
> blacklist instrumentation of arch code involved in early bootstrap.
> See e.g. KCOV_INSTRUMENT in arch/x86/boot/Makefile. I think you need
> to do the same for um. Start with bulk ignoring as much as possible
> until you get it booting and then bisect back from there.

oh, arch/um/* already contains the Makefile exception settings!
I guess CONFIG_KCOV_INSTRUMENT_ALL overrides the the Makefile settings?
Or doesn't it? I looked at scripts/Makefile.lib but failed to understand
what config options has precedens in that case.

greets
thomas 


Re: [tho...@m3y3r.de: Re: [PATCH] um: Fix kcov crash before kernel is started.]

2017-10-09 Thread Thomas Meyer
On Mon, Oct 09, 2017 at 08:10:45PM +0200, Dmitry Vyukov wrote:
> On Mon, Oct 9, 2017 at 6:47 PM, Thomas Meyer  wrote:
> > - Forwarded message from Thomas Meyer  -
> >
> > Hi,
> >
> > are you able to shed light on this topic?
> > Any help is greatly appreciated!
> >
> > With kind regards
> > thomas
> >
> > Date: Sun, 8 Oct 2017 13:18:24 +0200
> > From: Thomas Meyer 
> > To: Richard Weinberger 
> > Cc: user-mode-linux-de...@lists.sourceforge.net, 
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH] um: Fix kcov crash before kernel is started.
> > User-Agent: NeoMutt/20170113 (1.7.2)
> >
> > On Sun, Oct 08, 2017 at 12:44:12PM +0200, Richard Weinberger wrote:
> >> Am Sonntag, 8. Oktober 2017, 12:31:58 CEST schrieb Thomas Meyer:
> >> > UMLs current_thread_info() unconditionally assumes that the top of the 
> >> > stack
> >> > contains the thread_info structure. But on UML the 
> >> > __sanitizer_cov_trace_pc
> >> > function is called for *all* functions! This results in an early crash:
> >> >
> >> > Prevent kcov from using invalid curent_thread_info() data by checking
> >> > the system_state.
> >> >
> >> > Signed-off-by: Thomas Meyer 
> >> > ---
> >> >  kernel/kcov.c | 6 ++
> >> >  1 file changed, 6 insertions(+)
> >> >
> >> > diff --git a/kernel/kcov.c b/kernel/kcov.c
> >> > index 3f693a0f6f3e..d601c0e956f6 100644
> >> > --- a/kernel/kcov.c
> >> > +++ b/kernel/kcov.c
> >> > @@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
> >> > struct task_struct *t;
> >> > enum kcov_mode mode;
> >> >
> >> > +#ifdef CONFIG_UML
> >> > +   if(!(system_state == SYSTEM_SCHEDULING ||
> >> > +system_state == SYSTEM_RUNNING))
> >> > +   return;
> >> > +#endif
> >>
> >> Hmm, and why does it work on all other archs then?
> >
> > Hi,
> >
> > I guess UML is different then other archs! But to be honest I'm not sure
> > why. I assume that __sanitizer_cov_trace_pc on other archs isn't called
> > that early, or that curent_thread_info returns NULL on other archs when
> > the first task isn't running yet.
> >
> > But as I fail to use/setup the qemu gdb attachment to debug early x86_64 
> > code
> > I can't say exactly why.
> >
> > Maybe someone how knows the inner workings of x86_64 and/or kcov can
> > answer this question!
> 
> 
> Hi,

Hi,

> Yes, kcov can have some issues with early bootstrap code, because it
> accesses current and it can also conflict with say, per-cpu setup code
> (at least it was the case for x86). For x86 and arm64 we just bulk
> blacklist instrumentation of arch code involved in early bootstrap.
> See e.g. KCOV_INSTRUMENT in arch/x86/boot/Makefile. I think you need
> to do the same for um. Start with bulk ignoring as much as possible
> until you get it booting and then bisect back from there.

oh, arch/um/* already contains the Makefile exception settings!
I guess CONFIG_KCOV_INSTRUMENT_ALL overrides the the Makefile settings?
Or doesn't it? I looked at scripts/Makefile.lib but failed to understand
what config options has precedens in that case.

greets
thomas 


Re: [PATCH] um: Fix kcov crash before kernel is started.

2017-10-08 Thread Thomas Meyer
On Sun, Oct 08, 2017 at 12:44:12PM +0200, Richard Weinberger wrote:
> Am Sonntag, 8. Oktober 2017, 12:31:58 CEST schrieb Thomas Meyer:
> > UMLs current_thread_info() unconditionally assumes that the top of the stack
> > contains the thread_info structure. But on UML the __sanitizer_cov_trace_pc
> > function is called for *all* functions! This results in an early crash:
> > 
> > Prevent kcov from using invalid curent_thread_info() data by checking
> > the system_state.
> > 
> > Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
> > ---
> >  kernel/kcov.c | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/kernel/kcov.c b/kernel/kcov.c
> > index 3f693a0f6f3e..d601c0e956f6 100644
> > --- a/kernel/kcov.c
> > +++ b/kernel/kcov.c
> > @@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
> > struct task_struct *t;
> > enum kcov_mode mode;
> > 
> > +#ifdef CONFIG_UML
> > +   if(!(system_state == SYSTEM_SCHEDULING ||
> > +system_state == SYSTEM_RUNNING))
> > +   return;
> > +#endif
> 
> Hmm, and why does it work on all other archs then?

Hi,

I guess UML is different then other archs! But to be honest I'm not sure
why. I assume that __sanitizer_cov_trace_pc on other archs isn't called
that early, or that curent_thread_info returns NULL on other archs when
the first task isn't running yet.

But as I fail to use/setup the qemu gdb attachment to debug early x86_64 code
I can't say exactly why.

Maybe someone how knows the inner workings of x86_64 and/or kcov can
answer this question!

> 
> Thanks,
> //richard
> 


Re: [PATCH] um: Fix kcov crash before kernel is started.

2017-10-08 Thread Thomas Meyer
On Sun, Oct 08, 2017 at 12:44:12PM +0200, Richard Weinberger wrote:
> Am Sonntag, 8. Oktober 2017, 12:31:58 CEST schrieb Thomas Meyer:
> > UMLs current_thread_info() unconditionally assumes that the top of the stack
> > contains the thread_info structure. But on UML the __sanitizer_cov_trace_pc
> > function is called for *all* functions! This results in an early crash:
> > 
> > Prevent kcov from using invalid curent_thread_info() data by checking
> > the system_state.
> > 
> > Signed-off-by: Thomas Meyer 
> > ---
> >  kernel/kcov.c | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/kernel/kcov.c b/kernel/kcov.c
> > index 3f693a0f6f3e..d601c0e956f6 100644
> > --- a/kernel/kcov.c
> > +++ b/kernel/kcov.c
> > @@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
> > struct task_struct *t;
> > enum kcov_mode mode;
> > 
> > +#ifdef CONFIG_UML
> > +   if(!(system_state == SYSTEM_SCHEDULING ||
> > +system_state == SYSTEM_RUNNING))
> > +   return;
> > +#endif
> 
> Hmm, and why does it work on all other archs then?

Hi,

I guess UML is different then other archs! But to be honest I'm not sure
why. I assume that __sanitizer_cov_trace_pc on other archs isn't called
that early, or that curent_thread_info returns NULL on other archs when
the first task isn't running yet.

But as I fail to use/setup the qemu gdb attachment to debug early x86_64 code
I can't say exactly why.

Maybe someone how knows the inner workings of x86_64 and/or kcov can
answer this question!

> 
> Thanks,
> //richard
> 


[PATCH] um: Fix kcov crash before kernel is started.

2017-10-08 Thread Thomas Meyer
UMLs current_thread_info() unconditionally assumes that the top of the stack
contains the thread_info structure. But on UML the __sanitizer_cov_trace_pc
function is called for *all* functions! This results in an early crash:

Prevent kcov from using invalid curent_thread_info() data by checking
the system_state.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---
 kernel/kcov.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3f693a0f6f3e..d601c0e956f6 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
struct task_struct *t;
enum kcov_mode mode;
 
+#ifdef CONFIG_UML
+   if(!(system_state == SYSTEM_SCHEDULING ||
+system_state == SYSTEM_RUNNING))
+   return;
+#endif
+
t = current;
/*
 * We are interested in code coverage as a function of a syscall inputs,
-- 
2.11.0



[PATCH] um: Fix kcov crash before kernel is started.

2017-10-08 Thread Thomas Meyer
UMLs current_thread_info() unconditionally assumes that the top of the stack
contains the thread_info structure. But on UML the __sanitizer_cov_trace_pc
function is called for *all* functions! This results in an early crash:

Prevent kcov from using invalid curent_thread_info() data by checking
the system_state.

Signed-off-by: Thomas Meyer 
---
 kernel/kcov.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3f693a0f6f3e..d601c0e956f6 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -56,6 +56,12 @@ void notrace __sanitizer_cov_trace_pc(void)
struct task_struct *t;
enum kcov_mode mode;
 
+#ifdef CONFIG_UML
+   if(!(system_state == SYSTEM_SCHEDULING ||
+system_state == SYSTEM_RUNNING))
+   return;
+#endif
+
t = current;
/*
 * We are interested in code coverage as a function of a syscall inputs,
-- 
2.11.0



Re: Build regressions/improvements in v4.14-rc3

2017-10-08 Thread Thomas Meyer
On Sun, Oct 08, 2017 at 09:50:53AM +1100, Michael Ellerman wrote:
> Thomas Meyer <tho...@m3y3r.de> writes:
> 
> > On Thu, Oct 05, 2017 at 01:43:31PM +1100, Michael Ellerman wrote:
> >> Thomas Meyer <tho...@m3y3r.de> writes:
> >> > On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> >> ...
> >> >> 
> >> >> I've switched it to using one of the toolchains from Free Electrons,
> >> >> which is built with glibc, and that seems to be working:
> >> >> 
> >> >>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> >> >> 
> >> >> 
> >> >> Let me know if that's no good.
> >> >
> >> > Cool, excellent! Look good.
> >> >
> >> > Is it also possible to add an allyesconfig and allmodconfig for UML?
> >> 
> >> Sure.
> >> 
> >>   http://kisskb.ellerman.id.au/kisskb/config/484/
> >>   http://kisskb.ellerman.id.au/kisskb/config/485/
> >> 
> >> They don't build :D
> >> 
> >>   arch/um/drivers/vde_user.c:8:24: fatal error: libvdeplug.h: No such file 
> >> or directory
> >> 
> >> 
> >> Can I just disable that driver? I'd prefer not to install too many host
> >> packages just to get UML building.
> >
> > Yes, please disable all CONFIG_UML_NET_* drivers.
> > allmodconfig for UML is good to catch drivers which actually
> > should depend on HAS_IOMEM...
> 
> OK, I did that, and also turned off GCOV, now I get:
> 
>   ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] 
> undefined!
> 
> http://kisskb.ellerman.id.au/kisskb/buildresult/13175206/
>

Hi,

build looks good. Thanks for the setup!

Above problem is known, but I guess the driver is unmaintained:
See https://patchwork.kernel.org/patch/9893071/

> cheers


Re: Build regressions/improvements in v4.14-rc3

2017-10-08 Thread Thomas Meyer
On Sun, Oct 08, 2017 at 09:50:53AM +1100, Michael Ellerman wrote:
> Thomas Meyer  writes:
> 
> > On Thu, Oct 05, 2017 at 01:43:31PM +1100, Michael Ellerman wrote:
> >> Thomas Meyer  writes:
> >> > On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> >> ...
> >> >> 
> >> >> I've switched it to using one of the toolchains from Free Electrons,
> >> >> which is built with glibc, and that seems to be working:
> >> >> 
> >> >>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> >> >> 
> >> >> 
> >> >> Let me know if that's no good.
> >> >
> >> > Cool, excellent! Look good.
> >> >
> >> > Is it also possible to add an allyesconfig and allmodconfig for UML?
> >> 
> >> Sure.
> >> 
> >>   http://kisskb.ellerman.id.au/kisskb/config/484/
> >>   http://kisskb.ellerman.id.au/kisskb/config/485/
> >> 
> >> They don't build :D
> >> 
> >>   arch/um/drivers/vde_user.c:8:24: fatal error: libvdeplug.h: No such file 
> >> or directory
> >> 
> >> 
> >> Can I just disable that driver? I'd prefer not to install too many host
> >> packages just to get UML building.
> >
> > Yes, please disable all CONFIG_UML_NET_* drivers.
> > allmodconfig for UML is good to catch drivers which actually
> > should depend on HAS_IOMEM...
> 
> OK, I did that, and also turned off GCOV, now I get:
> 
>   ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] 
> undefined!
> 
> http://kisskb.ellerman.id.au/kisskb/buildresult/13175206/
>

Hi,

build looks good. Thanks for the setup!

Above problem is known, but I guess the driver is unmaintained:
See https://patchwork.kernel.org/patch/9893071/

> cheers


[PATCH] apparmor: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/security/apparmor/lsm.c b/security/apparmor/lsm.c
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -761,7 +761,7 @@ module_param_call(audit, param_set_audit
 /* Determines if audit header is included in audited messages.  This
  * provides more context if the audit daemon is not running
  */
-bool aa_g_audit_header = 1;
+bool aa_g_audit_header = true;
 module_param_named(audit_header, aa_g_audit_header, aabool,
   S_IRUSR | S_IWUSR);
 
@@ -786,7 +786,7 @@ module_param_named(path_max, aa_g_path_m
  * DEPRECATED: read only as strict checking of load is always done now
  * that none root users (user namespaces) can load policy.
  */
-bool aa_g_paranoid_load = 1;
+bool aa_g_paranoid_load = true;
 module_param_named(paranoid_load, aa_g_paranoid_load, aabool, S_IRUGO);
 
 /* Boot time disable flag */
@@ -1034,7 +1034,7 @@ static int __init apparmor_init(void)
 
if (!apparmor_enabled || !security_module_enable("apparmor")) {
aa_info_message("AppArmor disabled by boot time parameter");
-   apparmor_enabled = 0;
+   apparmor_enabled = false;
return 0;
}
 
@@ -1090,7 +1090,7 @@ alloc_out:
aa_destroy_aafs();
aa_teardown_dfa_engine();
 
-   apparmor_enabled = 0;
+   apparmor_enabled = false;
return error;
 }
 


[PATCH] apparmor: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/security/apparmor/lsm.c b/security/apparmor/lsm.c
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -761,7 +761,7 @@ module_param_call(audit, param_set_audit
 /* Determines if audit header is included in audited messages.  This
  * provides more context if the audit daemon is not running
  */
-bool aa_g_audit_header = 1;
+bool aa_g_audit_header = true;
 module_param_named(audit_header, aa_g_audit_header, aabool,
   S_IRUSR | S_IWUSR);
 
@@ -786,7 +786,7 @@ module_param_named(path_max, aa_g_path_m
  * DEPRECATED: read only as strict checking of load is always done now
  * that none root users (user namespaces) can load policy.
  */
-bool aa_g_paranoid_load = 1;
+bool aa_g_paranoid_load = true;
 module_param_named(paranoid_load, aa_g_paranoid_load, aabool, S_IRUGO);
 
 /* Boot time disable flag */
@@ -1034,7 +1034,7 @@ static int __init apparmor_init(void)
 
if (!apparmor_enabled || !security_module_enable("apparmor")) {
aa_info_message("AppArmor disabled by boot time parameter");
-   apparmor_enabled = 0;
+   apparmor_enabled = false;
return 0;
}
 
@@ -1090,7 +1090,7 @@ alloc_out:
aa_destroy_aafs();
aa_teardown_dfa_engine();
 
-   apparmor_enabled = 0;
+   apparmor_enabled = false;
return error;
 }
 


[PATCH] ceph: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/ceph/caps.c b/fs/ceph/caps.c
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1711,7 +1711,7 @@ void ceph_check_caps(struct ceph_inode_i
 
/* if we are unmounting, flush any unused caps immediately. */
if (mdsc->stopping)
-   is_delayed = 1;
+   is_delayed = true;
 
spin_lock(>i_ceph_lock);
 
@@ -3185,8 +3185,8 @@ static void handle_cap_flush_ack(struct
int dirty = le32_to_cpu(m->dirty);
int cleaned = 0;
bool drop = false;
-   bool wake_ci = 0;
-   bool wake_mdsc = 0;
+   bool wake_ci = false;
+   bool wake_mdsc = false;
 
list_for_each_entry_safe(cf, tmp_cf, >i_cap_flush_list, i_list) {
if (cf->tid == flush_tid)


[PATCH] ceph: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/ceph/caps.c b/fs/ceph/caps.c
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1711,7 +1711,7 @@ void ceph_check_caps(struct ceph_inode_i
 
/* if we are unmounting, flush any unused caps immediately. */
if (mdsc->stopping)
-   is_delayed = 1;
+   is_delayed = true;
 
spin_lock(>i_ceph_lock);
 
@@ -3185,8 +3185,8 @@ static void handle_cap_flush_ack(struct
int dirty = le32_to_cpu(m->dirty);
int cleaned = 0;
bool drop = false;
-   bool wake_ci = 0;
-   bool wake_mdsc = 0;
+   bool wake_ci = false;
+   bool wake_mdsc = false;
 
list_for_each_entry_safe(cf, tmp_cf, >i_cap_flush_list, i_list) {
if (cf->tid == flush_tid)


[PATCH] btrfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6958,7 +6958,7 @@ static int __btrfs_free_extent(struct bt
BUG_ON(!is_data && refs_to_drop != 1);
 
if (is_data)
-   skinny_metadata = 0;
+   skinny_metadata = false;
 
ret = lookup_extent_backref(trans, info, path, ,
bytenr, num_bytes, parent,
@@ -9311,7 +9311,7 @@ out:
 * don't have it in the radix (like when we recover after a power fail
 * or unmount) so we don't leak memory.
 */
-   if (!for_reloc && root_dropped == false)
+   if (!for_reloc && !root_dropped)
btrfs_add_dead_root(root);
if (err && err != -EAGAIN)
btrfs_handle_fs_error(fs_info, err, NULL);
diff -u -p a/fs/btrfs/file.c b/fs/btrfs/file.c
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2046,7 +2046,7 @@ int btrfs_sync_file(struct file *file, l
struct btrfs_trans_handle *trans;
struct btrfs_log_ctx ctx;
int ret = 0, err;
-   bool full_sync = 0;
+   bool full_sync = false;
u64 len;
 
/*
diff -u -p a/fs/btrfs/inode.c b/fs/btrfs/inode.c
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4439,9 +4439,9 @@ int btrfs_truncate_inode_items(struct bt
int err = 0;
u64 ino = btrfs_ino(BTRFS_I(inode));
u64 bytes_deleted = 0;
-   bool be_nice = 0;
-   bool should_throttle = 0;
-   bool should_end = 0;
+   bool be_nice = false;
+   bool should_throttle = false;
+   bool should_end = false;
 
BUG_ON(new_size > 0 && min_type != BTRFS_EXTENT_DATA_KEY);
 
@@ -4451,7 +4451,7 @@ int btrfs_truncate_inode_items(struct bt
 */
if (!btrfs_is_free_space_inode(BTRFS_I(inode)) &&
test_bit(BTRFS_ROOT_REF_COWS, >state))
-   be_nice = 1;
+   be_nice = true;
 
path = btrfs_alloc_path();
if (!path)
@@ -4657,7 +4657,7 @@ delete:
} else {
break;
}
-   should_throttle = 0;
+   should_throttle = false;
 
if (found_extent &&
(test_bit(BTRFS_ROOT_REF_COWS, >state) ||
@@ -4676,11 +4676,11 @@ delete:
if (be_nice) {
if (truncate_space_check(trans, root,
 extent_num_bytes)) {
-   should_end = 1;
+   should_end = true;
}
if (btrfs_should_throttle_delayed_refs(trans,
   fs_info))
-   should_throttle = 1;
+   should_throttle = true;
}
}
 


[PATCH] btrfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6958,7 +6958,7 @@ static int __btrfs_free_extent(struct bt
BUG_ON(!is_data && refs_to_drop != 1);
 
if (is_data)
-   skinny_metadata = 0;
+   skinny_metadata = false;
 
ret = lookup_extent_backref(trans, info, path, ,
bytenr, num_bytes, parent,
@@ -9311,7 +9311,7 @@ out:
 * don't have it in the radix (like when we recover after a power fail
 * or unmount) so we don't leak memory.
 */
-   if (!for_reloc && root_dropped == false)
+   if (!for_reloc && !root_dropped)
btrfs_add_dead_root(root);
if (err && err != -EAGAIN)
btrfs_handle_fs_error(fs_info, err, NULL);
diff -u -p a/fs/btrfs/file.c b/fs/btrfs/file.c
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2046,7 +2046,7 @@ int btrfs_sync_file(struct file *file, l
struct btrfs_trans_handle *trans;
struct btrfs_log_ctx ctx;
int ret = 0, err;
-   bool full_sync = 0;
+   bool full_sync = false;
u64 len;
 
/*
diff -u -p a/fs/btrfs/inode.c b/fs/btrfs/inode.c
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4439,9 +4439,9 @@ int btrfs_truncate_inode_items(struct bt
int err = 0;
u64 ino = btrfs_ino(BTRFS_I(inode));
u64 bytes_deleted = 0;
-   bool be_nice = 0;
-   bool should_throttle = 0;
-   bool should_end = 0;
+   bool be_nice = false;
+   bool should_throttle = false;
+   bool should_end = false;
 
BUG_ON(new_size > 0 && min_type != BTRFS_EXTENT_DATA_KEY);
 
@@ -4451,7 +4451,7 @@ int btrfs_truncate_inode_items(struct bt
 */
if (!btrfs_is_free_space_inode(BTRFS_I(inode)) &&
test_bit(BTRFS_ROOT_REF_COWS, >state))
-   be_nice = 1;
+   be_nice = true;
 
path = btrfs_alloc_path();
if (!path)
@@ -4657,7 +4657,7 @@ delete:
} else {
break;
}
-   should_throttle = 0;
+   should_throttle = false;
 
if (found_extent &&
(test_bit(BTRFS_ROOT_REF_COWS, >state) ||
@@ -4676,11 +4676,11 @@ delete:
if (be_nice) {
if (truncate_space_check(trans, root,
 extent_num_bytes)) {
-   should_end = 1;
+   should_end = true;
}
if (btrfs_should_throttle_delayed_refs(trans,
   fs_info))
-   should_throttle = 1;
+   should_throttle = true;
}
}
 


[PATCH] exofs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/exofs/super.c b/fs/exofs/super.c
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -116,7 +116,7 @@ static int parse_options(char *options,
  EXOFS_MIN_PID);
return -EINVAL;
}
-   s_pid = 1;
+   s_pid = true;
break;
case Opt_to:
if (match_int([0], ))


[PATCH] exofs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/exofs/super.c b/fs/exofs/super.c
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -116,7 +116,7 @@ static int parse_options(char *options,
  EXOFS_MIN_PID);
return -EINVAL;
}
-   s_pid = 1;
+   s_pid = true;
break;
case Opt_to:
if (match_int([0], ))


[PATCH] nfsd: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -230,7 +230,7 @@ do_open_lookup(struct svc_rqst *rqstp, s
if (!*resfh)
return nfserr_jukebox;
fh_init(*resfh, NFS4_FHSIZE);
-   open->op_truncate = 0;
+   open->op_truncate = false;
 
if (open->op_create) {
/* FIXME: check session persistence and pnfs flags.
@@ -360,7 +360,7 @@ nfsd4_open(struct svc_rqst *rqstp, struc
if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
return nfserr_inval;
 
-   open->op_created = 0;
+   open->op_created = false;
/*
 * RFC5661 18.51.3
 * Before RECLAIM_COMPLETE done, server should deny new lock
@@ -1108,8 +1108,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struc
else {
copy->cp_res.wr_bytes_written = bytes;
copy->cp_res.wr_stable_how = NFS_UNSTABLE;
-   copy->cp_consecutive = 1;
-   copy->cp_synchronous = 1;
+   copy->cp_consecutive = true;
+   copy->cp_synchronous = true;
gen_boot_verifier(>cp_res.wr_verifier, SVC_NET(rqstp));
status = nfs_ok;
}
@@ -2476,7 +2476,7 @@ bool nfsd4_spo_must_allow(struct svc_rqs
if (!cstate->minorversion)
return false;
 
-   if (cstate->spo_must_allowed == true)
+   if (cstate->spo_must_allowed)
return true;
 
opiter = resp->opcnt;
diff -u -p a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -292,7 +292,7 @@ static int nfsd_startup_net(int nrservs,
ret = lockd_up(net);
if (ret)
goto out_socks;
-   nn->lockd_up = 1;
+   nn->lockd_up = true;
}
 
ret = nfs4_state_start_net(net);
@@ -305,7 +305,7 @@ static int nfsd_startup_net(int nrservs,
 out_lockd:
if (nn->lockd_up) {
lockd_down(net);
-   nn->lockd_up = 0;
+   nn->lockd_up = false;
}
 out_socks:
nfsd_shutdown_generic();
@@ -319,7 +319,7 @@ static void nfsd_shutdown_net(struct net
nfs4_state_shutdown_net(net);
if (nn->lockd_up) {
lockd_down(net);
-   nn->lockd_up = 0;
+   nn->lockd_up = false;
}
nn->nfsd_net_up = false;
nfsd_shutdown_generic();
diff -u -p a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1379,7 +1379,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
&& d_inode(dchild)->i_atime.tv_sec == v_atime
&& d_inode(dchild)->i_size  == 0 ) {
if (created)
-   *created = 1;
+   *created = true;
break;
}
case NFS4_CREATE_EXCLUSIVE4_1:
@@ -1387,7 +1387,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
&& d_inode(dchild)->i_atime.tv_sec == v_atime
&& d_inode(dchild)->i_size  == 0 ) {
if (created)
-   *created = 1;
+   *created = true;
goto set_attr;
}
 /* fallthru */
@@ -1404,7 +1404,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
goto out_nfserr;
}
if (created)
-   *created = 1;
+   *created = true;
 
nfsd_check_ignore_resizing(iap);
 


[PATCH] nfsd: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -230,7 +230,7 @@ do_open_lookup(struct svc_rqst *rqstp, s
if (!*resfh)
return nfserr_jukebox;
fh_init(*resfh, NFS4_FHSIZE);
-   open->op_truncate = 0;
+   open->op_truncate = false;
 
if (open->op_create) {
/* FIXME: check session persistence and pnfs flags.
@@ -360,7 +360,7 @@ nfsd4_open(struct svc_rqst *rqstp, struc
if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
return nfserr_inval;
 
-   open->op_created = 0;
+   open->op_created = false;
/*
 * RFC5661 18.51.3
 * Before RECLAIM_COMPLETE done, server should deny new lock
@@ -1108,8 +1108,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struc
else {
copy->cp_res.wr_bytes_written = bytes;
copy->cp_res.wr_stable_how = NFS_UNSTABLE;
-   copy->cp_consecutive = 1;
-   copy->cp_synchronous = 1;
+   copy->cp_consecutive = true;
+   copy->cp_synchronous = true;
gen_boot_verifier(>cp_res.wr_verifier, SVC_NET(rqstp));
status = nfs_ok;
}
@@ -2476,7 +2476,7 @@ bool nfsd4_spo_must_allow(struct svc_rqs
if (!cstate->minorversion)
return false;
 
-   if (cstate->spo_must_allowed == true)
+   if (cstate->spo_must_allowed)
return true;
 
opiter = resp->opcnt;
diff -u -p a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -292,7 +292,7 @@ static int nfsd_startup_net(int nrservs,
ret = lockd_up(net);
if (ret)
goto out_socks;
-   nn->lockd_up = 1;
+   nn->lockd_up = true;
}
 
ret = nfs4_state_start_net(net);
@@ -305,7 +305,7 @@ static int nfsd_startup_net(int nrservs,
 out_lockd:
if (nn->lockd_up) {
lockd_down(net);
-   nn->lockd_up = 0;
+   nn->lockd_up = false;
}
 out_socks:
nfsd_shutdown_generic();
@@ -319,7 +319,7 @@ static void nfsd_shutdown_net(struct net
nfs4_state_shutdown_net(net);
if (nn->lockd_up) {
lockd_down(net);
-   nn->lockd_up = 0;
+   nn->lockd_up = false;
}
nn->nfsd_net_up = false;
nfsd_shutdown_generic();
diff -u -p a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1379,7 +1379,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
&& d_inode(dchild)->i_atime.tv_sec == v_atime
&& d_inode(dchild)->i_size  == 0 ) {
if (created)
-   *created = 1;
+   *created = true;
break;
}
case NFS4_CREATE_EXCLUSIVE4_1:
@@ -1387,7 +1387,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
&& d_inode(dchild)->i_atime.tv_sec == v_atime
&& d_inode(dchild)->i_size  == 0 ) {
if (created)
-   *created = 1;
+   *created = true;
goto set_attr;
}
 /* fallthru */
@@ -1404,7 +1404,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
goto out_nfserr;
}
if (created)
-   *created = 1;
+   *created = true;
 
nfsd_check_ignore_resizing(iap);
 


[PATCH] proc: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/proc/generic.c b/fs/proc/generic.c
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -325,7 +325,7 @@ static int proc_register(struct proc_dir
 
write_lock(_subdir_lock);
dp->parent = dir;
-   if (pde_subdir_insert(dir, dp) == false) {
+   if (!pde_subdir_insert(dir, dp)) {
WARN(1, "proc_dir_entry '%s/%s' already registered\n",
 dir->name, dp->name);
write_unlock(_subdir_lock);


[PATCH] proc: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/proc/generic.c b/fs/proc/generic.c
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -325,7 +325,7 @@ static int proc_register(struct proc_dir
 
write_lock(_subdir_lock);
dp->parent = dir;
-   if (pde_subdir_insert(dir, dp) == false) {
+   if (!pde_subdir_insert(dir, dp)) {
WARN(1, "proc_dir_entry '%s/%s' already registered\n",
 dir->name, dp->name);
write_unlock(_subdir_lock);


[PATCH] NFS: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -439,7 +439,7 @@ static bool referring_call_exists(struct
  uint32_t nrclists,
  struct referring_call_list *rclists)
 {
-   bool status = 0;
+   bool status = false;
int i, j;
struct nfs4_session *session;
struct nfs4_slot_table *tbl;
diff -u -p a/fs/nfs/dir.c b/fs/nfs/dir.c
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -253,7 +253,7 @@ int nfs_readdir_search_for_pos(struct nf
desc->cache_entry_index = index;
return 0;
 out_eof:
-   desc->eof = 1;
+   desc->eof = true;
return -EBADCOOKIE;
 }
 
@@ -307,7 +307,7 @@ int nfs_readdir_search_for_cookie(struct
if (array->eof_index >= 0) {
status = -EBADCOOKIE;
if (*desc->dir_cookie == array->last_cookie)
-   desc->eof = 1;
+   desc->eof = true;
}
 out:
return status;
@@ -761,7 +761,7 @@ int nfs_do_filldir(nfs_readdir_descripto
ent = >array[i];
if (!dir_emit(desc->ctx, ent->string.name, ent->string.len,
nfs_compat_user_ino64(ent->ino), ent->d_type)) {
-   desc->eof = 1;
+   desc->eof = true;
break;
}
desc->ctx->pos++;
@@ -773,7 +773,7 @@ int nfs_do_filldir(nfs_readdir_descripto
ctx->duped = 1;
}
if (array->eof_index >= 0)
-   desc->eof = 1;
+   desc->eof = true;
 
kunmap(desc->page);
cache_page_release(desc);
@@ -873,7 +873,7 @@ static int nfs_readdir(struct file *file
if (res == -EBADCOOKIE) {
res = 0;
/* This means either end of directory */
-   if (*desc->dir_cookie && desc->eof == 0) {
+   if (*desc->dir_cookie && !desc->eof) {
/* Or that the server has 'lost' a cookie */
res = uncached_readdir(desc);
if (res == 0)
diff -u -p a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -793,7 +793,7 @@ nfs4_find_client_sessionid(struct net *n
 
spin_lock(>nfs_client_lock);
list_for_each_entry(clp, >nfs_client_list, cl_share_link) {
-   if (nfs4_cb_match_client(addr, clp, minorversion) == false)
+   if (!nfs4_cb_match_client(addr, clp, minorversion))
continue;
 
if (!nfs4_has_session(clp))
diff -u -p a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1513,7 +1513,7 @@ pnfs_lseg_range_match(const struct pnfs_
if ((range->iomode == IOMODE_RW &&
 ls_range->iomode != IOMODE_RW) ||
(range->iomode != ls_range->iomode &&
-strict_iomode == true) ||
+strict_iomode) ||
!pnfs_lseg_range_intersecting(ls_range, range))
return 0;
 


[PATCH] NFS: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -439,7 +439,7 @@ static bool referring_call_exists(struct
  uint32_t nrclists,
  struct referring_call_list *rclists)
 {
-   bool status = 0;
+   bool status = false;
int i, j;
struct nfs4_session *session;
struct nfs4_slot_table *tbl;
diff -u -p a/fs/nfs/dir.c b/fs/nfs/dir.c
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -253,7 +253,7 @@ int nfs_readdir_search_for_pos(struct nf
desc->cache_entry_index = index;
return 0;
 out_eof:
-   desc->eof = 1;
+   desc->eof = true;
return -EBADCOOKIE;
 }
 
@@ -307,7 +307,7 @@ int nfs_readdir_search_for_cookie(struct
if (array->eof_index >= 0) {
status = -EBADCOOKIE;
if (*desc->dir_cookie == array->last_cookie)
-   desc->eof = 1;
+   desc->eof = true;
}
 out:
return status;
@@ -761,7 +761,7 @@ int nfs_do_filldir(nfs_readdir_descripto
ent = >array[i];
if (!dir_emit(desc->ctx, ent->string.name, ent->string.len,
nfs_compat_user_ino64(ent->ino), ent->d_type)) {
-   desc->eof = 1;
+   desc->eof = true;
break;
}
desc->ctx->pos++;
@@ -773,7 +773,7 @@ int nfs_do_filldir(nfs_readdir_descripto
ctx->duped = 1;
}
if (array->eof_index >= 0)
-   desc->eof = 1;
+   desc->eof = true;
 
kunmap(desc->page);
cache_page_release(desc);
@@ -873,7 +873,7 @@ static int nfs_readdir(struct file *file
if (res == -EBADCOOKIE) {
res = 0;
/* This means either end of directory */
-   if (*desc->dir_cookie && desc->eof == 0) {
+   if (*desc->dir_cookie && !desc->eof) {
/* Or that the server has 'lost' a cookie */
res = uncached_readdir(desc);
if (res == 0)
diff -u -p a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -793,7 +793,7 @@ nfs4_find_client_sessionid(struct net *n
 
spin_lock(>nfs_client_lock);
list_for_each_entry(clp, >nfs_client_list, cl_share_link) {
-   if (nfs4_cb_match_client(addr, clp, minorversion) == false)
+   if (!nfs4_cb_match_client(addr, clp, minorversion))
continue;
 
if (!nfs4_has_session(clp))
diff -u -p a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1513,7 +1513,7 @@ pnfs_lseg_range_match(const struct pnfs_
if ((range->iomode == IOMODE_RW &&
 ls_range->iomode != IOMODE_RW) ||
(range->iomode != ls_range->iomode &&
-strict_iomode == true) ||
+strict_iomode) ||
!pnfs_lseg_range_intersecting(ls_range, range))
return 0;
 


[PATCH] pstore: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c
--- a/fs/pstore/ftrace.c
+++ b/fs/pstore/ftrace.c
@@ -148,7 +148,7 @@ void pstore_unregister_ftrace(void)
mutex_lock(_ftrace_lock);
if (pstore_ftrace_enabled) {
unregister_ftrace_function(_ftrace_ops);
-   pstore_ftrace_enabled = 0;
+   pstore_ftrace_enabled = false;
}
mutex_unlock(_ftrace_lock);
 


[PATCH] pstore: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c
--- a/fs/pstore/ftrace.c
+++ b/fs/pstore/ftrace.c
@@ -148,7 +148,7 @@ void pstore_unregister_ftrace(void)
mutex_lock(_ftrace_lock);
if (pstore_ftrace_enabled) {
unregister_ftrace_function(_ftrace_ops);
-   pstore_ftrace_enabled = 0;
+   pstore_ftrace_enabled = false;
}
mutex_unlock(_ftrace_lock);
 


[PATCH] configfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/configfs/file.c b/fs/configfs/file.c
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -166,7 +166,7 @@ configfs_read_bin_file(struct file *file
retval = -ETXTBSY;
goto out;
}
-   buffer->read_in_progress = 1;
+   buffer->read_in_progress = true;
 
if (buffer->needs_read_fill) {
/* perform first read with buf == NULL to get extent */
@@ -325,7 +325,7 @@ configfs_write_bin_file(struct file *fil
len = -ETXTBSY;
goto out;
}
-   buffer->write_in_progress = 1;
+   buffer->write_in_progress = true;
 
/* buffer grows? */
if (*ppos + count > buffer->bin_buffer_size) {
@@ -429,8 +429,8 @@ static int check_perm(struct inode * ino
}
mutex_init(>mutex);
buffer->needs_read_fill = 1;
-   buffer->read_in_progress = 0;
-   buffer->write_in_progress = 0;
+   buffer->read_in_progress = false;
+   buffer->write_in_progress = false;
buffer->ops = ops;
file->private_data = buffer;
goto Done;
@@ -488,10 +488,10 @@ static int configfs_release_bin_file(str
ssize_t len = 0;
int ret;
 
-   buffer->read_in_progress = 0;
+   buffer->read_in_progress = false;
 
if (buffer->write_in_progress) {
-   buffer->write_in_progress = 0;
+   buffer->write_in_progress = false;
 
len = bin_attr->write(item, buffer->bin_buffer,
buffer->bin_buffer_size);


[PATCH] configfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/configfs/file.c b/fs/configfs/file.c
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -166,7 +166,7 @@ configfs_read_bin_file(struct file *file
retval = -ETXTBSY;
goto out;
}
-   buffer->read_in_progress = 1;
+   buffer->read_in_progress = true;
 
if (buffer->needs_read_fill) {
/* perform first read with buf == NULL to get extent */
@@ -325,7 +325,7 @@ configfs_write_bin_file(struct file *fil
len = -ETXTBSY;
goto out;
}
-   buffer->write_in_progress = 1;
+   buffer->write_in_progress = true;
 
/* buffer grows? */
if (*ppos + count > buffer->bin_buffer_size) {
@@ -429,8 +429,8 @@ static int check_perm(struct inode * ino
}
mutex_init(>mutex);
buffer->needs_read_fill = 1;
-   buffer->read_in_progress = 0;
-   buffer->write_in_progress = 0;
+   buffer->read_in_progress = false;
+   buffer->write_in_progress = false;
buffer->ops = ops;
file->private_data = buffer;
goto Done;
@@ -488,10 +488,10 @@ static int configfs_release_bin_file(str
ssize_t len = 0;
int ret;
 
-   buffer->read_in_progress = 0;
+   buffer->read_in_progress = false;
 
if (buffer->write_in_progress) {
-   buffer->write_in_progress = 0;
+   buffer->write_in_progress = false;
 
len = bin_attr->write(item, buffer->bin_buffer,
buffer->bin_buffer_size);


[PATCH] f2fs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/f2fs/data.c b/fs/f2fs/data.c
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -419,7 +419,7 @@ next:
bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;
 
/* set submitted = 1 as a return value */
-   fio->submitted = 1;
+   fio->submitted = true;
 
inc_page_count(sbi, WB_DATA_TYPE(bio_page));
 


[PATCH] f2fs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/f2fs/data.c b/fs/f2fs/data.c
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -419,7 +419,7 @@ next:
bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;
 
/* set submitted = 1 as a return value */
-   fio->submitted = 1;
+   fio->submitted = true;
 
inc_page_count(sbi, WB_DATA_TYPE(bio_page));
 


Cocci spatch "boolinit" - v4.14-rc1

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Found by coccinelle spatch "misc/boolinit.cocci"

Run against version v4.14-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


Cocci spatch "boolinit" - v4.14-rc1

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Found by coccinelle spatch "misc/boolinit.cocci"

Run against version v4.14-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci


[PATCH] ima: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -32,7 +32,7 @@ bool ima_canonical_fmt;
 static int __init default_canonical_fmt_setup(char *str)
 {
 #ifdef __BIG_ENDIAN
-   ima_canonical_fmt = 1;
+   ima_canonical_fmt = true;
 #endif
return 1;
 }
diff -u -p a/security/integrity/ima/ima_policy.c 
b/security/integrity/ima/ima_policy.c
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -196,9 +196,9 @@ static int __init policy_setup(char *str
if ((strcmp(p, "tcb") == 0) && !ima_policy)
ima_policy = DEFAULT_TCB;
else if (strcmp(p, "appraise_tcb") == 0)
-   ima_use_appraise_tcb = 1;
+   ima_use_appraise_tcb = true;
else if (strcmp(p, "secure_boot") == 0)
-   ima_use_secure_boot = 1;
+   ima_use_secure_boot = true;
}
 
return 1;
@@ -207,7 +207,7 @@ __setup("ima_policy=", policy_setup);
 
 static int __init default_appraise_policy_setup(char *str)
 {
-   ima_use_appraise_tcb = 1;
+   ima_use_appraise_tcb = true;
return 1;
 }
 __setup("ima_appraise_tcb", default_appraise_policy_setup);


[PATCH] ima: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -32,7 +32,7 @@ bool ima_canonical_fmt;
 static int __init default_canonical_fmt_setup(char *str)
 {
 #ifdef __BIG_ENDIAN
-   ima_canonical_fmt = 1;
+   ima_canonical_fmt = true;
 #endif
return 1;
 }
diff -u -p a/security/integrity/ima/ima_policy.c 
b/security/integrity/ima/ima_policy.c
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -196,9 +196,9 @@ static int __init policy_setup(char *str
if ((strcmp(p, "tcb") == 0) && !ima_policy)
ima_policy = DEFAULT_TCB;
else if (strcmp(p, "appraise_tcb") == 0)
-   ima_use_appraise_tcb = 1;
+   ima_use_appraise_tcb = true;
else if (strcmp(p, "secure_boot") == 0)
-   ima_use_secure_boot = 1;
+   ima_use_secure_boot = true;
}
 
return 1;
@@ -207,7 +207,7 @@ __setup("ima_policy=", policy_setup);
 
 static int __init default_appraise_policy_setup(char *str)
 {
-   ima_use_appraise_tcb = 1;
+   ima_use_appraise_tcb = true;
return 1;
 }
 __setup("ima_appraise_tcb", default_appraise_policy_setup);


[PATCH] bfq: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/block/bfq-iosched.c b/block/bfq-iosched.c
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4986,7 +4986,7 @@ static ssize_t bfq_low_latency_store(str
 
if (__data > 1)
__data = 1;
-   if (__data == 0 && bfqd->low_latency != 0)
+   if (__data == 0 && bfqd->low_latency)
bfq_end_wr(bfqd);
bfqd->low_latency = __data;
 


[PATCH] bfq: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/block/bfq-iosched.c b/block/bfq-iosched.c
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4986,7 +4986,7 @@ static ssize_t bfq_low_latency_store(str
 
if (__data > 1)
__data = 1;
-   if (__data == 0 && bfqd->low_latency != 0)
+   if (__data == 0 && bfqd->low_latency)
bfq_end_wr(bfqd);
bfqd->low_latency = __data;
 


[PATCH] xfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1490,14 +1490,14 @@ xfs_bmap_isaeof(
int is_empty;
int error;
 
-   bma->aeof = 0;
+   bma->aeof = false;
error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, ,
 _empty);
if (error)
return error;
 
if (is_empty) {
-   bma->aeof = 1;
+   bma->aeof = true;
return 0;
}
 
diff -u -p a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -1962,7 +1962,7 @@ xfs_difree_inobt(
if (!(mp->m_flags & XFS_MOUNT_IKEEP) &&
rec.ir_free == XFS_INOBT_ALL_FREE &&
mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) {
-   xic->deleted = 1;
+   xic->deleted = true;
xic->first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino);
xic->alloc = xfs_inobt_irec_to_allocmask();
 
@@ -1989,7 +1989,7 @@ xfs_difree_inobt(
 
xfs_difree_inode_chunk(mp, agno, , dfops);
} else {
-   xic->deleted = 0;
+   xic->deleted = false;
 
error = xfs_inobt_update(cur, );
if (error) {
diff -u -p a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -761,7 +761,7 @@ xfs_file_fallocate(
enum xfs_prealloc_flags flags = 0;
uintiolock = XFS_IOLOCK_EXCL;
loff_t  new_size = 0;
-   booldo_file_insert = 0;
+   booldo_file_insert = false;
 
if (!S_ISREG(inode->i_mode))
return -EINVAL;
@@ -822,7 +822,7 @@ xfs_file_fallocate(
error = -EINVAL;
goto out_unlock;
}
-   do_file_insert = 1;
+   do_file_insert = true;
} else {
flags |= XFS_PREALLOC_SET;
 
diff -u -p a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2515,7 +2515,7 @@ next_lv:
if (lv)
vecp = lv->lv_iovecp;
}
-   if (record_cnt == 0 && ordered == false) {
+   if (record_cnt == 0 && !ordered) {
if (!lv)
return 0;
break;
diff -u -p a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -704,7 +704,7 @@ xfs_mountfs(
xfs_set_maxicount(mp);
 
/* enable fail_at_unmount as default */
-   mp->m_fail_unmount = 1;
+   mp->m_fail_unmount = true;
 
error = xfs_sysfs_init(>m_kobj, _mp_ktype, NULL, mp->m_fsname);
if (error)


[PATCH] xfs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1490,14 +1490,14 @@ xfs_bmap_isaeof(
int is_empty;
int error;
 
-   bma->aeof = 0;
+   bma->aeof = false;
error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, ,
 _empty);
if (error)
return error;
 
if (is_empty) {
-   bma->aeof = 1;
+   bma->aeof = true;
return 0;
}
 
diff -u -p a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -1962,7 +1962,7 @@ xfs_difree_inobt(
if (!(mp->m_flags & XFS_MOUNT_IKEEP) &&
rec.ir_free == XFS_INOBT_ALL_FREE &&
mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) {
-   xic->deleted = 1;
+   xic->deleted = true;
xic->first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino);
xic->alloc = xfs_inobt_irec_to_allocmask();
 
@@ -1989,7 +1989,7 @@ xfs_difree_inobt(
 
xfs_difree_inode_chunk(mp, agno, , dfops);
} else {
-   xic->deleted = 0;
+   xic->deleted = false;
 
error = xfs_inobt_update(cur, );
if (error) {
diff -u -p a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -761,7 +761,7 @@ xfs_file_fallocate(
enum xfs_prealloc_flags flags = 0;
uintiolock = XFS_IOLOCK_EXCL;
loff_t  new_size = 0;
-   booldo_file_insert = 0;
+   booldo_file_insert = false;
 
if (!S_ISREG(inode->i_mode))
return -EINVAL;
@@ -822,7 +822,7 @@ xfs_file_fallocate(
error = -EINVAL;
goto out_unlock;
}
-   do_file_insert = 1;
+   do_file_insert = true;
} else {
flags |= XFS_PREALLOC_SET;
 
diff -u -p a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2515,7 +2515,7 @@ next_lv:
if (lv)
vecp = lv->lv_iovecp;
}
-   if (record_cnt == 0 && ordered == false) {
+   if (record_cnt == 0 && !ordered) {
if (!lv)
return 0;
break;
diff -u -p a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -704,7 +704,7 @@ xfs_mountfs(
xfs_set_maxicount(mp);
 
/* enable fail_at_unmount as default */
-   mp->m_fail_unmount = 1;
+   mp->m_fail_unmount = true;
 
error = xfs_sysfs_init(>m_kobj, _mp_ktype, NULL, mp->m_fsname);
if (error)


[PATCH] ext4: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/ext4/extents.c b/fs/ext4/extents.c
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5242,7 +5242,7 @@ ext4_ext_shift_path_extents(struct ext4_
 {
int depth, err = 0;
struct ext4_extent *ex_start, *ex_last;
-   bool update = 0;
+   bool update = false;
depth = path->p_depth;
 
while (depth >= 0) {
@@ -5258,7 +5258,7 @@ ext4_ext_shift_path_extents(struct ext4_
goto out;
 
if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr))
-   update = 1;
+   update = true;
 
while (ex_start <= ex_last) {
if (SHIFT == SHIFT_LEFT) {


[PATCH] ext4: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/ext4/extents.c b/fs/ext4/extents.c
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5242,7 +5242,7 @@ ext4_ext_shift_path_extents(struct ext4_
 {
int depth, err = 0;
struct ext4_extent *ex_start, *ex_last;
-   bool update = 0;
+   bool update = false;
depth = path->p_depth;
 
while (depth >= 0) {
@@ -5258,7 +5258,7 @@ ext4_ext_shift_path_extents(struct ext4_
goto out;
 
if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr))
-   update = 1;
+   update = true;
 
while (ex_start <= ex_last) {
if (SHIFT == SHIFT_LEFT) {


[PATCH] selinux: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -550,7 +550,7 @@ int mls_compute_sid(struct context *scon
 
/* Fallthrough */
case AVTAB_CHANGE:
-   if ((tclass == policydb.process_class) || (sock == true))
+   if ((tclass == policydb.process_class) || (sock))
/* Use the process MLS attributes. */
return mls_context_cpy(newcontext, scontext);
else
diff -u -p a/security/selinux/ss/services.c b/security/selinux/ss/services.c
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1656,7 +1656,7 @@ static int security_compute_sid(u32 ssid
} else if (cladatum && cladatum->default_role == DEFAULT_TARGET) {
newcontext.role = tcontext->role;
} else {
-   if ((tclass == policydb.process_class) || (sock == true))
+   if ((tclass == policydb.process_class) || (sock))
newcontext.role = scontext->role;
else
newcontext.role = OBJECT_R_VAL;
@@ -1668,7 +1668,7 @@ static int security_compute_sid(u32 ssid
} else if (cladatum && cladatum->default_type == DEFAULT_TARGET) {
newcontext.type = tcontext->type;
} else {
-   if ((tclass == policydb.process_class) || (sock == true)) {
+   if ((tclass == policydb.process_class) || (sock)) {
/* Use the type of process. */
newcontext.type = scontext->type;
} else {


[PATCH] selinux: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -550,7 +550,7 @@ int mls_compute_sid(struct context *scon
 
/* Fallthrough */
case AVTAB_CHANGE:
-   if ((tclass == policydb.process_class) || (sock == true))
+   if ((tclass == policydb.process_class) || (sock))
/* Use the process MLS attributes. */
return mls_context_cpy(newcontext, scontext);
else
diff -u -p a/security/selinux/ss/services.c b/security/selinux/ss/services.c
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1656,7 +1656,7 @@ static int security_compute_sid(u32 ssid
} else if (cladatum && cladatum->default_role == DEFAULT_TARGET) {
newcontext.role = tcontext->role;
} else {
-   if ((tclass == policydb.process_class) || (sock == true))
+   if ((tclass == policydb.process_class) || (sock))
newcontext.role = scontext->role;
else
newcontext.role = OBJECT_R_VAL;
@@ -1668,7 +1668,7 @@ static int security_compute_sid(u32 ssid
} else if (cladatum && cladatum->default_type == DEFAULT_TARGET) {
newcontext.type = tcontext->type;
} else {
-   if ((tclass == policydb.process_class) || (sock == true)) {
+   if ((tclass == policydb.process_class) || (sock)) {
/* Use the type of process. */
newcontext.type = scontext->type;
} else {


[PATCH] cifs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -370,7 +370,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb,
else
is_group = false;
 
-   if (is_well_known_sid(psid, _id, is_group) == false)
+   if (!is_well_known_sid(psid, _id, is_group))
goto try_upcall_to_get_id;
 
if (is_group) {
diff -u -p a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -4508,7 +4508,7 @@ findFirstRetry:
psrch_inf->unicode = false;
 
psrch_inf->ntwrk_buf_start = (char *)pSMBr;
-   psrch_inf->smallBuf = 0;
+   psrch_inf->smallBuf = false;
psrch_inf->srch_entries_start =
(char *) >hdr.Protocol +
le16_to_cpu(pSMBr->t2.DataOffset);
@@ -4642,7 +4642,7 @@ int CIFSFindNext(const unsigned int xid,
cifs_buf_release(psrch_inf->ntwrk_buf_start);
psrch_inf->srch_entries_start = response_data;
psrch_inf->ntwrk_buf_start = (char *)pSMB;
-   psrch_inf->smallBuf = 0;
+   psrch_inf->smallBuf = false;
if (parms->EndofSearch)
psrch_inf->endOfSearch = true;
else
diff -u -p a/fs/cifs/connect.c b/fs/cifs/connect.c
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1081,7 +1081,7 @@ static int cifs_parse_security_flavors(c
break;
 #endif
case Opt_sec_none:
-   vol->nullauth = 1;
+   vol->nullauth = true;
break;
default:
cifs_dbg(VFS, "bad security option: %s\n", value);
@@ -1265,9 +1265,9 @@ cifs_parse_mount_options(const char *mou
 
/* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */
/* default is always to request posix paths. */
-   vol->posix_paths = 1;
+   vol->posix_paths = true;
/* default to using server inode numbers where available */
-   vol->server_ino = 1;
+   vol->server_ino = true;
 
/* default is to use strict cifs caching semantics */
vol->strict_io = true;
@@ -1333,10 +1333,10 @@ cifs_parse_mount_options(const char *mou
 
/* Boolean values */
case Opt_user_xattr:
-   vol->no_xattr = 0;
+   vol->no_xattr = false;
break;
case Opt_nouser_xattr:
-   vol->no_xattr = 1;
+   vol->no_xattr = true;
break;
case Opt_forceuid:
override_uid = 1;
@@ -1351,22 +1351,22 @@ cifs_parse_mount_options(const char *mou
override_gid = 0;
break;
case Opt_noblocksend:
-   vol->noblocksnd = 1;
+   vol->noblocksnd = true;
break;
case Opt_noautotune:
-   vol->noautotune = 1;
+   vol->noautotune = true;
break;
case Opt_hard:
-   vol->retry = 1;
+   vol->retry = true;
break;
case Opt_soft:
-   vol->retry = 0;
+   vol->retry = false;
break;
case Opt_perm:
-   vol->noperm = 0;
+   vol->noperm = false;
break;
case Opt_noperm:
-   vol->noperm = 1;
+   vol->noperm = true;
break;
case Opt_mapchars:
vol->sfu_remap = true;
@@ -1383,31 +1383,31 @@ cifs_parse_mount_options(const char *mou
vol->remap = false;
break;
case Opt_sfu:
-   vol->sfu_emul = 1;
+   vol->sfu_emul = true;
break;
case Opt_nosfu:
-   vol->sfu_emul = 0;
+   vol->sfu_emul = false;
break;
case Opt_nodfs:
-   vol->nodfs = 1;
+   vol->nodfs = true;
break;
case Opt_posixpaths:
-   vol-

[PATCH] afs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/afs/cache.c b/fs/afs/cache.c
--- a/fs/afs/cache.c
+++ b/fs/afs/cache.c
@@ -195,7 +195,7 @@ enum fscache_checkaux afs_vlocation_cach
 * VL record from the cache */
if (!vlocation->valid || vlocation->vldb.rtime == cvldb->rtime) {
memcpy((uint8_t *)>vldb.nservers, buffer, dlen);
-   vlocation->valid = 1;
+   vlocation->valid = true;
_leave(" = SUCCESS [c->m]");
return FSCACHE_CHECKAUX_OKAY;
}
diff -u -p a/fs/afs/super.c b/fs/afs/super.c
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -211,7 +211,7 @@ static int afs_parse_options(struct afs_
break;
 
case afs_opt_rwpath:
-   params->rwpath = 1;
+   params->rwpath = true;
break;
 
case afs_opt_vol:
@@ -219,7 +219,7 @@ static int afs_parse_options(struct afs_
break;
 
case afs_opt_autocell:
-   params->autocell = 1;
+   params->autocell = true;
break;
 
default:
diff -u -p a/fs/afs/vlocation.c b/fs/afs/vlocation.c
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -154,7 +154,7 @@ out:
printk(KERN_NOTICE "kAFS:"
   " Active volume no longer valid '%s'\n",
   vl->vldb.name);
-   vl->valid = 0;
+   vl->valid = false;
ret = -ENOMEDIUM;
}
 


[PATCH] cifs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -370,7 +370,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb,
else
is_group = false;
 
-   if (is_well_known_sid(psid, _id, is_group) == false)
+   if (!is_well_known_sid(psid, _id, is_group))
goto try_upcall_to_get_id;
 
if (is_group) {
diff -u -p a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -4508,7 +4508,7 @@ findFirstRetry:
psrch_inf->unicode = false;
 
psrch_inf->ntwrk_buf_start = (char *)pSMBr;
-   psrch_inf->smallBuf = 0;
+   psrch_inf->smallBuf = false;
psrch_inf->srch_entries_start =
(char *) >hdr.Protocol +
le16_to_cpu(pSMBr->t2.DataOffset);
@@ -4642,7 +4642,7 @@ int CIFSFindNext(const unsigned int xid,
cifs_buf_release(psrch_inf->ntwrk_buf_start);
psrch_inf->srch_entries_start = response_data;
psrch_inf->ntwrk_buf_start = (char *)pSMB;
-   psrch_inf->smallBuf = 0;
+   psrch_inf->smallBuf = false;
if (parms->EndofSearch)
psrch_inf->endOfSearch = true;
else
diff -u -p a/fs/cifs/connect.c b/fs/cifs/connect.c
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1081,7 +1081,7 @@ static int cifs_parse_security_flavors(c
break;
 #endif
case Opt_sec_none:
-   vol->nullauth = 1;
+   vol->nullauth = true;
break;
default:
cifs_dbg(VFS, "bad security option: %s\n", value);
@@ -1265,9 +1265,9 @@ cifs_parse_mount_options(const char *mou
 
/* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */
/* default is always to request posix paths. */
-   vol->posix_paths = 1;
+   vol->posix_paths = true;
/* default to using server inode numbers where available */
-   vol->server_ino = 1;
+   vol->server_ino = true;
 
/* default is to use strict cifs caching semantics */
vol->strict_io = true;
@@ -1333,10 +1333,10 @@ cifs_parse_mount_options(const char *mou
 
/* Boolean values */
case Opt_user_xattr:
-   vol->no_xattr = 0;
+   vol->no_xattr = false;
break;
case Opt_nouser_xattr:
-   vol->no_xattr = 1;
+   vol->no_xattr = true;
break;
case Opt_forceuid:
override_uid = 1;
@@ -1351,22 +1351,22 @@ cifs_parse_mount_options(const char *mou
override_gid = 0;
break;
case Opt_noblocksend:
-   vol->noblocksnd = 1;
+   vol->noblocksnd = true;
break;
case Opt_noautotune:
-   vol->noautotune = 1;
+   vol->noautotune = true;
break;
case Opt_hard:
-   vol->retry = 1;
+   vol->retry = true;
break;
case Opt_soft:
-   vol->retry = 0;
+   vol->retry = false;
break;
case Opt_perm:
-   vol->noperm = 0;
+   vol->noperm = false;
break;
case Opt_noperm:
-   vol->noperm = 1;
+   vol->noperm = true;
break;
case Opt_mapchars:
vol->sfu_remap = true;
@@ -1383,31 +1383,31 @@ cifs_parse_mount_options(const char *mou
vol->remap = false;
break;
case Opt_sfu:
-   vol->sfu_emul = 1;
+   vol->sfu_emul = true;
break;
case Opt_nosfu:
-   vol->sfu_emul = 0;
+   vol->sfu_emul = false;
break;
case Opt_nodfs:
-   vol->nodfs = 1;
+   vol->nodfs = true;
break;
case Opt_posixpaths:
-   vol->posix_paths = 1;
+ 

[PATCH] afs: Fix bool initialization/comparison

2017-10-07 Thread Thomas Meyer
Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/afs/cache.c b/fs/afs/cache.c
--- a/fs/afs/cache.c
+++ b/fs/afs/cache.c
@@ -195,7 +195,7 @@ enum fscache_checkaux afs_vlocation_cach
 * VL record from the cache */
if (!vlocation->valid || vlocation->vldb.rtime == cvldb->rtime) {
memcpy((uint8_t *)>vldb.nservers, buffer, dlen);
-   vlocation->valid = 1;
+   vlocation->valid = true;
_leave(" = SUCCESS [c->m]");
return FSCACHE_CHECKAUX_OKAY;
}
diff -u -p a/fs/afs/super.c b/fs/afs/super.c
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -211,7 +211,7 @@ static int afs_parse_options(struct afs_
break;
 
case afs_opt_rwpath:
-   params->rwpath = 1;
+   params->rwpath = true;
break;
 
case afs_opt_vol:
@@ -219,7 +219,7 @@ static int afs_parse_options(struct afs_
break;
 
case afs_opt_autocell:
-   params->autocell = 1;
+   params->autocell = true;
break;
 
default:
diff -u -p a/fs/afs/vlocation.c b/fs/afs/vlocation.c
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -154,7 +154,7 @@ out:
printk(KERN_NOTICE "kAFS:"
   " Active volume no longer valid '%s'\n",
   vl->vldb.name);
-   vl->valid = 0;
+   vl->valid = false;
ret = -ENOMEDIUM;
}
 


Re: Build regressions/improvements in v4.14-rc3

2017-10-05 Thread Thomas Meyer
On Thu, Oct 05, 2017 at 01:43:31PM +1100, Michael Ellerman wrote:
> Thomas Meyer <tho...@m3y3r.de> writes:
> > On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> ...
> >> 
> >> I've switched it to using one of the toolchains from Free Electrons,
> >> which is built with glibc, and that seems to be working:
> >> 
> >>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> >> 
> >> 
> >> Let me know if that's no good.
> >
> > Cool, excellent! Look good.
> >
> > Is it also possible to add an allyesconfig and allmodconfig for UML?
> 
> Sure.
> 
>   http://kisskb.ellerman.id.au/kisskb/config/484/
>   http://kisskb.ellerman.id.au/kisskb/config/485/
> 
> They don't build :D
> 
>   arch/um/drivers/vde_user.c:8:24: fatal error: libvdeplug.h: No such file or 
> directory
> 
> 
> Can I just disable that driver? I'd prefer not to install too many host
> packages just to get UML building.

Yes, please disable all CONFIG_UML_NET_* drivers.
allmodconfig for UML is good to catch drivers which actually
should depend on HAS_IOMEM...

mfg
thomas

> 
> cheers


Re: Build regressions/improvements in v4.14-rc3

2017-10-05 Thread Thomas Meyer
On Thu, Oct 05, 2017 at 01:43:31PM +1100, Michael Ellerman wrote:
> Thomas Meyer  writes:
> > On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> ...
> >> 
> >> I've switched it to using one of the toolchains from Free Electrons,
> >> which is built with glibc, and that seems to be working:
> >> 
> >>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> >> 
> >> 
> >> Let me know if that's no good.
> >
> > Cool, excellent! Look good.
> >
> > Is it also possible to add an allyesconfig and allmodconfig for UML?
> 
> Sure.
> 
>   http://kisskb.ellerman.id.au/kisskb/config/484/
>   http://kisskb.ellerman.id.au/kisskb/config/485/
> 
> They don't build :D
> 
>   arch/um/drivers/vde_user.c:8:24: fatal error: libvdeplug.h: No such file or 
> directory
> 
> 
> Can I just disable that driver? I'd prefer not to install too many host
> packages just to get UML building.

Yes, please disable all CONFIG_UML_NET_* drivers.
allmodconfig for UML is good to catch drivers which actually
should depend on HAS_IOMEM...

mfg
thomas

> 
> cheers


kselftest on UML results - 4.14.0-rc3-00019-g78d8732cf2d8

2017-10-03 Thread Thomas Meyer
Hi,

here are the results from running the kselftests under UML, created with the 
script
available here:
https://github.com/thomasmey/uml/blob/master/uml-fedora-kselftest.sh

1.) code coverage
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/coverage/index.html

2.) cyclomatic complexity
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-cyc-comp.txt

3.) kernel build stderr output
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-kernel-build-stderr.txt

4.) kselftests output:
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-kselftests.txt

PS: I have a question regarding the cyclomatic complexity: What is the
meaning of it? I mean I read the definition on Wikipedia, but what do I
do with those results?  The ten most "complex" functions are:

Cyclomatic Complexity 730 
/home/thomas/git/linux/drivers/md/bcache/super.c:cache_alloc 
Cyclomatic Complexity 299 
/home/thomas/git/linux/drivers/misc/altera-stapl/altera.c:altera_execute 
Cyclomatic Complexity 272 
/home/thomas/git/linux/drivers/net/wireless/ti/wl18xx/debugfs.c:wl18xx_debugfs_add_files
 
Cyclomatic Complexity 266 
/home/thomas/git/linux/drivers/md/bcache/super.c:bch_cache_set_alloc 
Cyclomatic Complexity 252 
/home/thomas/git/linux/fs/ext4/super.c:ext4_fill_super 
Cyclomatic Complexity 234 
/home/thomas/git/linux/net/core/pktgen.c:pktgen_if_write 
Cyclomatic Complexity 220 
/home/thomas/git/linux/mm/page_alloc.c:alloc_large_system_hash 
Cyclomatic Complexity 218 /home/thomas/git/linux/net/sctp/protocol.c:sctp_init 
Cyclomatic Complexity 216 /home/thomas/git/linux/crypto/tcrypt.c:do_test 
Cyclomatic Complexity 210 
/home/thomas/git/linux/lib/rhashtable.c:rhashtable_init 

So is bcache/super.c:cache_alloc a place where bugs lurk?

With kind regards
thomas



kselftest on UML results - 4.14.0-rc3-00019-g78d8732cf2d8

2017-10-03 Thread Thomas Meyer
Hi,

here are the results from running the kselftests under UML, created with the 
script
available here:
https://github.com/thomasmey/uml/blob/master/uml-fedora-kselftest.sh

1.) code coverage
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/coverage/index.html

2.) cyclomatic complexity
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-cyc-comp.txt

3.) kernel build stderr output
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-kernel-build-stderr.txt

4.) kselftests output:
http://m3y3r.de/kselftest/4.14.0-rc3-00019-g78d8732cf2d8/result-kselftests.txt

PS: I have a question regarding the cyclomatic complexity: What is the
meaning of it? I mean I read the definition on Wikipedia, but what do I
do with those results?  The ten most "complex" functions are:

Cyclomatic Complexity 730 
/home/thomas/git/linux/drivers/md/bcache/super.c:cache_alloc 
Cyclomatic Complexity 299 
/home/thomas/git/linux/drivers/misc/altera-stapl/altera.c:altera_execute 
Cyclomatic Complexity 272 
/home/thomas/git/linux/drivers/net/wireless/ti/wl18xx/debugfs.c:wl18xx_debugfs_add_files
 
Cyclomatic Complexity 266 
/home/thomas/git/linux/drivers/md/bcache/super.c:bch_cache_set_alloc 
Cyclomatic Complexity 252 
/home/thomas/git/linux/fs/ext4/super.c:ext4_fill_super 
Cyclomatic Complexity 234 
/home/thomas/git/linux/net/core/pktgen.c:pktgen_if_write 
Cyclomatic Complexity 220 
/home/thomas/git/linux/mm/page_alloc.c:alloc_large_system_hash 
Cyclomatic Complexity 218 /home/thomas/git/linux/net/sctp/protocol.c:sctp_init 
Cyclomatic Complexity 216 /home/thomas/git/linux/crypto/tcrypt.c:do_test 
Cyclomatic Complexity 210 
/home/thomas/git/linux/lib/rhashtable.c:rhashtable_init 

So is bcache/super.c:cache_alloc a place where bugs lurk?

With kind regards
thomas



Re: Build regressions/improvements in v4.14-rc3

2017-10-03 Thread Thomas Meyer
On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> Geert Uytterhoeven <ge...@linux-m68k.org> writes:
> 
> > Hi Thomas,
> >
> > On Mon, Oct 2, 2017 at 4:11 PM, Thomas Meyer <tho...@m3y3r.de> wrote:
> >> On Mon, Oct 02, 2017 at 11:49:33AM +0200, Geert Uytterhoeven wrote:
> >>> Below is the list of build error/warning regressions/improvements in
> >>> v4.14-rc3[1] compared to v4.13[2].
> >>
> >> a question regarding the um-defconfig build:
> >> http://kisskb.ellerman.id.au/kisskb/target/2974/
> >>
> >> The error thrown looks like a libc installation error. can this be fixed
> >> on the build server?
> >
> > I'll let Michael answer that question...
> 
> Thanks for the report.
> 
> I think the problem is simply that the toolchain has no libc, so it
> can't build UML (?).

Yes, UML needs a libc.

> 
> I've switched it to using one of the toolchains from Free Electrons,
> which is built with glibc, and that seems to be working:
> 
>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> 
> 
> Let me know if that's no good.

Cool, excellent! Look good.

Is it also possible to add an allyesconfig and allmodconfig for UML?

Many thanks for looking into this.

with kind regards
thomas

> 
> cheers


Re: Build regressions/improvements in v4.14-rc3

2017-10-03 Thread Thomas Meyer
On Tue, Oct 03, 2017 at 08:18:14PM +1100, Michael Ellerman wrote:
> Geert Uytterhoeven  writes:
> 
> > Hi Thomas,
> >
> > On Mon, Oct 2, 2017 at 4:11 PM, Thomas Meyer  wrote:
> >> On Mon, Oct 02, 2017 at 11:49:33AM +0200, Geert Uytterhoeven wrote:
> >>> Below is the list of build error/warning regressions/improvements in
> >>> v4.14-rc3[1] compared to v4.13[2].
> >>
> >> a question regarding the um-defconfig build:
> >> http://kisskb.ellerman.id.au/kisskb/target/2974/
> >>
> >> The error thrown looks like a libc installation error. can this be fixed
> >> on the build server?
> >
> > I'll let Michael answer that question...
> 
> Thanks for the report.
> 
> I think the problem is simply that the toolchain has no libc, so it
> can't build UML (?).

Yes, UML needs a libc.

> 
> I've switched it to using one of the toolchains from Free Electrons,
> which is built with glibc, and that seems to be working:
> 
>   http://kisskb.ellerman.id.au/kisskb/buildresult/13171418/
> 
> 
> Let me know if that's no good.

Cool, excellent! Look good.

Is it also possible to add an allyesconfig and allmodconfig for UML?

Many thanks for looking into this.

with kind regards
thomas

> 
> cheers


Re: Build regressions/improvements in v4.14-rc3

2017-10-02 Thread Thomas Meyer
On Mon, Oct 02, 2017 at 11:49:33AM +0200, Geert Uytterhoeven wrote:
> Below is the list of build error/warning regressions/improvements in
> v4.14-rc3[1] compared to v4.13[2].

Hi,

a question regarding the um-defconfig build:
http://kisskb.ellerman.id.au/kisskb/target/2974/

The error thrown looks like a libc installation error. can this be fixed
on the build server?

> Summarized:
>   - build errors: +8/-0
>   - build warnings: +1155/-6331
> 
> 
> Gr{oetje,eeting}s,
> 
>   Geert

with kind regards
thomas

> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
>   -- Linus Torvalds


Re: Build regressions/improvements in v4.14-rc3

2017-10-02 Thread Thomas Meyer
On Mon, Oct 02, 2017 at 11:49:33AM +0200, Geert Uytterhoeven wrote:
> Below is the list of build error/warning regressions/improvements in
> v4.14-rc3[1] compared to v4.13[2].

Hi,

a question regarding the um-defconfig build:
http://kisskb.ellerman.id.au/kisskb/target/2974/

The error thrown looks like a libc installation error. can this be fixed
on the build server?

> Summarized:
>   - build errors: +8/-0
>   - build warnings: +1155/-6331
> 
> 
> Gr{oetje,eeting}s,
> 
>   Geert

with kind regards
thomas

> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
>   -- Linus Torvalds


[PATCH] gcov: GCOV_KERNEL and GCOV are mutually exclusive

2017-09-26 Thread Thomas Meyer
Fix it by forcing the user to choose one of the two GCOV options.

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---
 kernel/gcov/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig
index 1276aabaab55..6c0dd2a6d4fd 100644
--- a/kernel/gcov/Kconfig
+++ b/kernel/gcov/Kconfig
@@ -3,6 +3,7 @@ menu "GCOV-based kernel profiling"
 config GCOV_KERNEL
bool "Enable gcov-based kernel profiling"
depends on DEBUG_FS
+   depends on !GCOV
select CONSTRUCTORS if !UML
default n
---help---
-- 
2.11.0



[PATCH] gcov: GCOV_KERNEL and GCOV are mutually exclusive

2017-09-26 Thread Thomas Meyer
Fix it by forcing the user to choose one of the two GCOV options.

Signed-off-by: Thomas Meyer 
---
 kernel/gcov/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig
index 1276aabaab55..6c0dd2a6d4fd 100644
--- a/kernel/gcov/Kconfig
+++ b/kernel/gcov/Kconfig
@@ -3,6 +3,7 @@ menu "GCOV-based kernel profiling"
 config GCOV_KERNEL
bool "Enable gcov-based kernel profiling"
depends on DEBUG_FS
+   depends on !GCOV
select CONSTRUCTORS if !UML
default n
---help---
-- 
2.11.0



radeon_get_bios: BUG: unable to handle kernel paging request

2017-09-24 Thread Thomas Meyer
Hi,

while trying to resurrect my old Macbook as an 32 bit kernel testing device,
I think someone broke the radeon driver on this first generation pure EFI boot
Macbook.

My guess would be that the introduction of the vga_switcheroo code did break the
radeon_get_bios functionality.

I will try again without radeon_atrm_get_bios and radeon_acpi_vfct_bios.

kind regards
thomas

[0.00] Linux version 4.14.0-rc1+ (thomas@maria) (gcc version 7.1.1 
20170622 (Red Hat 7.1.1-3) (GCC)) #7 SMP Sun Sep 24 07:16:00 CEST 2017
[0.00] Disabled fast string operations
[0.00] x86/fpu: x87 FPU will use FXSAVE
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0008efff] usable
[0.00] BIOS-e820: [mem 0x0008f000-0x0008] ACPI NVS
[0.00] BIOS-e820: [mem 0x0009-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x7f0c7fff] usable
[0.00] BIOS-e820: [mem 0x7f0c8000-0x7f2c8fff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7f2c9000-0x7fe4afff] usable
[0.00] BIOS-e820: [mem 0x7fe4b000-0x7fe6efff] reserved
[0.00] BIOS-e820: [mem 0x7fe6f000-0x7fe7efff] usable
[0.00] BIOS-e820: [mem 0x7fe7f000-0x7feaafff] reserved
[0.00] BIOS-e820: [mem 0x7feab000-0x7feb1fff] usable
[0.00] BIOS-e820: [mem 0x7feb2000-0x7feb6fff] ACPI data
[0.00] BIOS-e820: [mem 0x7feb7000-0x7feb8fff] usable
[0.00] BIOS-e820: [mem 0x7feb9000-0x7feeefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7feef000-0x7fefefff] ACPI data
[0.00] BIOS-e820: [mem 0x7feff000-0x7fef] reserved
[0.00] BIOS-e820: [mem 0xe00f8000-0xe00f8fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfffb-0xfffd] reserved
[0.00] Notice: NX (Execute Disable) protection cannot be enabled: 
non-PAE kernel!
[0.00] e820: update [mem 0x7bf6f010-0x7bf7ea3b] usable ==> usable
[0.00] e820: update [mem 0x7bf6f010-0x7bf7ea3b] usable ==> usable
[0.00] extended physical RAM map:
[0.00] reserve setup_data: [mem 0x-0x0008efff] 
usable
[0.00] reserve setup_data: [mem 0x0008f000-0x0008] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x0009-0x0009] 
usable
[0.00] reserve setup_data: [mem 0x0010-0x7bf6f00f] 
usable
[0.00] reserve setup_data: [mem 0x7bf6f010-0x7bf7ea3b] 
usable
[0.00] reserve setup_data: [mem 0x7bf7ea3c-0x7f0c7fff] 
usable
[0.00] reserve setup_data: [mem 0x7f0c8000-0x7f2c8fff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7f2c9000-0x7fe4afff] 
usable
[0.00] reserve setup_data: [mem 0x7fe4b000-0x7fe6efff] 
reserved
[0.00] reserve setup_data: [mem 0x7fe6f000-0x7fe7efff] 
usable
[0.00] reserve setup_data: [mem 0x7fe7f000-0x7feaafff] 
reserved
[0.00] reserve setup_data: [mem 0x7feab000-0x7feb1fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb2000-0x7feb6fff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feb7000-0x7feb8fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb9000-0x7feeefff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7feef000-0x7fefefff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feff000-0x7fef] 
reserved
[0.00] reserve setup_data: [mem 0xe00f8000-0xe00f8fff] 
reserved
[0.00] reserve setup_data: [mem 0xfed1c000-0xfed1] 
reserved
[0.00] reserve setup_data: [mem 0xfffb-0xfffd] 
reserved
[0.00] efi: EFI v1.10 by Apple
[0.00] efi:  ACPI=0x7fefd000  ACPI 2.0=0x7fefd014  SMBIOS=0x7feba000 
[0.00] random: fast init done
[0.00] SMBIOS 2.4 present.
[0.00] DMI: Apple Computer, Inc. MacBookPro1,1/Mac-F425BEC8, BIOS
MBP11.88Z.0055.B08.0610121325 10/12/06
[0.00] tsc: Fast TSC calibration using PIT
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x7feb9 max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-C write-protect
[0.00]   D-D uncachable
[0.00]   E-F write-protect
[0.00] 

radeon_get_bios: BUG: unable to handle kernel paging request

2017-09-24 Thread Thomas Meyer
Hi,

while trying to resurrect my old Macbook as an 32 bit kernel testing device,
I think someone broke the radeon driver on this first generation pure EFI boot
Macbook.

My guess would be that the introduction of the vga_switcheroo code did break the
radeon_get_bios functionality.

I will try again without radeon_atrm_get_bios and radeon_acpi_vfct_bios.

kind regards
thomas

[0.00] Linux version 4.14.0-rc1+ (thomas@maria) (gcc version 7.1.1 
20170622 (Red Hat 7.1.1-3) (GCC)) #7 SMP Sun Sep 24 07:16:00 CEST 2017
[0.00] Disabled fast string operations
[0.00] x86/fpu: x87 FPU will use FXSAVE
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0008efff] usable
[0.00] BIOS-e820: [mem 0x0008f000-0x0008] ACPI NVS
[0.00] BIOS-e820: [mem 0x0009-0x0009] usable
[0.00] BIOS-e820: [mem 0x0010-0x7f0c7fff] usable
[0.00] BIOS-e820: [mem 0x7f0c8000-0x7f2c8fff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7f2c9000-0x7fe4afff] usable
[0.00] BIOS-e820: [mem 0x7fe4b000-0x7fe6efff] reserved
[0.00] BIOS-e820: [mem 0x7fe6f000-0x7fe7efff] usable
[0.00] BIOS-e820: [mem 0x7fe7f000-0x7feaafff] reserved
[0.00] BIOS-e820: [mem 0x7feab000-0x7feb1fff] usable
[0.00] BIOS-e820: [mem 0x7feb2000-0x7feb6fff] ACPI data
[0.00] BIOS-e820: [mem 0x7feb7000-0x7feb8fff] usable
[0.00] BIOS-e820: [mem 0x7feb9000-0x7feeefff] ACPI NVS
[0.00] BIOS-e820: [mem 0x7feef000-0x7fefefff] ACPI data
[0.00] BIOS-e820: [mem 0x7feff000-0x7fef] reserved
[0.00] BIOS-e820: [mem 0xe00f8000-0xe00f8fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfffb-0xfffd] reserved
[0.00] Notice: NX (Execute Disable) protection cannot be enabled: 
non-PAE kernel!
[0.00] e820: update [mem 0x7bf6f010-0x7bf7ea3b] usable ==> usable
[0.00] e820: update [mem 0x7bf6f010-0x7bf7ea3b] usable ==> usable
[0.00] extended physical RAM map:
[0.00] reserve setup_data: [mem 0x-0x0008efff] 
usable
[0.00] reserve setup_data: [mem 0x0008f000-0x0008] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x0009-0x0009] 
usable
[0.00] reserve setup_data: [mem 0x0010-0x7bf6f00f] 
usable
[0.00] reserve setup_data: [mem 0x7bf6f010-0x7bf7ea3b] 
usable
[0.00] reserve setup_data: [mem 0x7bf7ea3c-0x7f0c7fff] 
usable
[0.00] reserve setup_data: [mem 0x7f0c8000-0x7f2c8fff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7f2c9000-0x7fe4afff] 
usable
[0.00] reserve setup_data: [mem 0x7fe4b000-0x7fe6efff] 
reserved
[0.00] reserve setup_data: [mem 0x7fe6f000-0x7fe7efff] 
usable
[0.00] reserve setup_data: [mem 0x7fe7f000-0x7feaafff] 
reserved
[0.00] reserve setup_data: [mem 0x7feab000-0x7feb1fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb2000-0x7feb6fff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feb7000-0x7feb8fff] 
usable
[0.00] reserve setup_data: [mem 0x7feb9000-0x7feeefff] 
ACPI NVS
[0.00] reserve setup_data: [mem 0x7feef000-0x7fefefff] 
ACPI data
[0.00] reserve setup_data: [mem 0x7feff000-0x7fef] 
reserved
[0.00] reserve setup_data: [mem 0xe00f8000-0xe00f8fff] 
reserved
[0.00] reserve setup_data: [mem 0xfed1c000-0xfed1] 
reserved
[0.00] reserve setup_data: [mem 0xfffb-0xfffd] 
reserved
[0.00] efi: EFI v1.10 by Apple
[0.00] efi:  ACPI=0x7fefd000  ACPI 2.0=0x7fefd014  SMBIOS=0x7feba000 
[0.00] random: fast init done
[0.00] SMBIOS 2.4 present.
[0.00] DMI: Apple Computer, Inc. MacBookPro1,1/Mac-F425BEC8, BIOS
MBP11.88Z.0055.B08.0610121325 10/12/06
[0.00] tsc: Fast TSC calibration using PIT
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x7feb9 max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-C write-protect
[0.00]   D-D uncachable
[0.00]   E-F write-protect
[0.00] 

[PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch "alloc_cast"

2017-09-21 Thread Thomas Meyer
Remove casting the values returned by memory allocation functions like
kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc."
Found by coccinelle spatch "api/alloc/alloc_cast.cocci"

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -53,7 +53,7 @@ static struct kmem_cache * ncp_inode_cac
 static struct inode *ncp_alloc_inode(struct super_block *sb)
 {
struct ncp_inode_info *ei;
-   ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, 
GFP_KERNEL);
+   ei = kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
if (!ei)
return NULL;
return >vfs_inode;


[PATCH 1/4] drm/amd/powerplay: Cocci spatch "alloc_cast"

2017-09-21 Thread Thomas Meyer
Remove casting the values returned by memory allocation functions like
kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc."
Found by coccinelle spatch "api/alloc/alloc_cast.cocci"

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---

diff -u -p a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -291,7 +291,7 @@ static int get_mm_clock_voltage_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
mm_dependency_table->ucNumEntries;
-   mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
+   mm_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!mm_table)
@@ -519,7 +519,7 @@ static int get_socclk_voltage_dependency
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
 
-   clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
+   clk_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!clk_table)
@@ -554,7 +554,7 @@ static int get_mclk_voltage_dependency_t
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
mclk_dep_table->ucNumEntries;
 
-   mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
+   mclk_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!mclk_table)
@@ -596,7 +596,7 @@ static int get_gfxclk_voltage_dependency
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
 
-   clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+   clk_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!clk_table)
@@ -663,7 +663,7 @@ static int get_pix_clk_voltage_dependenc
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
 
-   clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+   clk_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!clk_table)
@@ -728,7 +728,7 @@ static int get_dcefclk_voltage_dependenc
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
num_entries;
 
-   clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
+   clk_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!clk_table)
@@ -772,7 +772,7 @@ static int get_pcie_table(struct pp_hwmg
sizeof(struct phm_ppt_v1_pcie_record) *
atom_pcie_table->ucNumEntries;
 
-   pcie_table = (struct phm_ppt_v1_pcie_table *)
+   pcie_table =
kzalloc(table_size, GFP_KERNEL);
 
if (!pcie_table)
@@ -1026,7 +1026,7 @@ static int get_vddc_lookup_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
 
-   table = (phm_ppt_v1_voltage_lookup_table *)
+   table =
kzalloc(table_size, GFP_KERNEL);
 
if (NULL == table)


[PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch "alloc_cast"

2017-09-21 Thread Thomas Meyer
Remove casting the values returned by memory allocation functions like
kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc."
Found by coccinelle spatch "api/alloc/alloc_cast.cocci"

Signed-off-by: Thomas Meyer 
---

diff -u -p a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -53,7 +53,7 @@ static struct kmem_cache * ncp_inode_cac
 static struct inode *ncp_alloc_inode(struct super_block *sb)
 {
struct ncp_inode_info *ei;
-   ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, 
GFP_KERNEL);
+   ei = kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
if (!ei)
return NULL;
return >vfs_inode;


  1   2   3   4   5   6   7   >