summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-11-01 14:53:27 -0400
committerDavid S. Miller <davem@davemloft.net>2014-11-01 14:53:27 -0400
commit55b42b5ca2dcf143465968697fe6c6503b05fca1 (patch)
tree91878cd53efc44ba67244d4d3897020828c87c01 /lib
parent10738eeaf4ab3de092586cefcc082e7d43ca0044 (diff)
parentec1f1276022e4e3ca40871810217d513e39ff250 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/phy/marvell.c Simple overlapping changes in drivers/net/phy/marvell.c Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c8
-rw-r--r--lib/cmdline.c29
-rw-r--r--lib/scatterlist.c6
-rw-r--r--lib/string.c16
4 files changed, 54 insertions, 5 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index cd250a2e14cb..b499ab6ada29 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst,
131 lower = src[off + k]; 131 lower = src[off + k];
132 if (left && off + k == lim - 1) 132 if (left && off + k == lim - 1)
133 lower &= mask; 133 lower &= mask;
134 dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; 134 dst[k] = lower >> rem;
135 if (rem)
136 dst[k] |= upper << (BITS_PER_LONG - rem);
135 if (left && k == lim - 1) 137 if (left && k == lim - 1)
136 dst[k] &= mask; 138 dst[k] &= mask;
137 } 139 }
@@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst,
172 upper = src[k]; 174 upper = src[k];
173 if (left && k == lim - 1) 175 if (left && k == lim - 1)
174 upper &= (1UL << left) - 1; 176 upper &= (1UL << left) - 1;
175 dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; 177 dst[k + off] = upper << rem;
178 if (rem)
179 dst[k + off] |= lower >> (BITS_PER_LONG - rem);
176 if (left && k + off == lim - 1) 180 if (left && k + off == lim - 1)
177 dst[k + off] &= (1UL << left) - 1; 181 dst[k + off] &= (1UL << left) - 1;
178 } 182 }
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 76a712e6e20e..8f13cf73c2ec 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -160,3 +160,32 @@ unsigned long long memparse(const char *ptr, char **retptr)
160 return ret; 160 return ret;
161} 161}
162EXPORT_SYMBOL(memparse); 162EXPORT_SYMBOL(memparse);
163
164/**
165 * parse_option_str - Parse a string and check an option is set or not
166 * @str: String to be parsed
167 * @option: option name
168 *
169 * This function parses a string containing a comma-separated list of
170 * strings like a=b,c.
171 *
172 * Return true if there's such option in the string, or return false.
173 */
174bool parse_option_str(const char *str, const char *option)
175{
176 while (*str) {
177 if (!strncmp(str, option, strlen(option))) {
178 str += strlen(option);
179 if (!*str || *str == ',')
180 return true;
181 }
182
183 while (*str && *str != ',')
184 str++;
185
186 if (*str == ',')
187 str++;
188 }
189
190 return false;
191}
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 9cdf62f8accd..c9f2e8c6ccc9 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents,
203 } 203 }
204 204
205 table->orig_nents -= sg_size; 205 table->orig_nents -= sg_size;
206 if (!skip_first_chunk) { 206 if (skip_first_chunk)
207 free_fn(sgl, alloc_size);
208 skip_first_chunk = false; 207 skip_first_chunk = false;
209 } 208 else
209 free_fn(sgl, alloc_size);
210 sgl = next; 210 sgl = next;
211 } 211 }
212 212
diff --git a/lib/string.c b/lib/string.c
index 2fc20aa06f84..10063300b830 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -598,6 +598,22 @@ void *memset(void *s, int c, size_t count)
598EXPORT_SYMBOL(memset); 598EXPORT_SYMBOL(memset);
599#endif 599#endif
600 600
601/**
602 * memzero_explicit - Fill a region of memory (e.g. sensitive
603 * keying data) with 0s.
604 * @s: Pointer to the start of the area.
605 * @count: The size of the area.
606 *
607 * memzero_explicit() doesn't need an arch-specific version as
608 * it just invokes the one of memset() implicitly.
609 */
610void memzero_explicit(void *s, size_t count)
611{
612 memset(s, 0, count);
613 OPTIMIZER_HIDE_VAR(s);
614}
615EXPORT_SYMBOL(memzero_explicit);
616
601#ifndef __HAVE_ARCH_MEMCPY 617#ifndef __HAVE_ARCH_MEMCPY
602/** 618/**
603 * memcpy - Copy one area of memory to another 619 * memcpy - Copy one area of memory to another