diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/kasprintf.c | 2 | ||||
| -rw-r--r-- | lib/scatterlist.c | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/kasprintf.c b/lib/kasprintf.c index ae0de80c1c88..32f12150fc4f 100644 --- a/lib/kasprintf.c +++ b/lib/kasprintf.c | |||
| @@ -21,7 +21,7 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap) | |||
| 21 | len = vsnprintf(NULL, 0, fmt, aq); | 21 | len = vsnprintf(NULL, 0, fmt, aq); |
| 22 | va_end(aq); | 22 | va_end(aq); |
| 23 | 23 | ||
| 24 | p = kmalloc(len+1, gfp); | 24 | p = kmalloc_track_caller(len+1, gfp); |
| 25 | if (!p) | 25 | if (!p) |
| 26 | return NULL; | 26 | return NULL; |
| 27 | 27 | ||
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index e76d85cf3175..3675452b23ca 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
| @@ -39,6 +39,25 @@ struct scatterlist *sg_next(struct scatterlist *sg) | |||
| 39 | EXPORT_SYMBOL(sg_next); | 39 | EXPORT_SYMBOL(sg_next); |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| 42 | * sg_nents - return total count of entries in scatterlist | ||
| 43 | * @sg: The scatterlist | ||
| 44 | * | ||
| 45 | * Description: | ||
| 46 | * Allows to know how many entries are in sg, taking into acount | ||
| 47 | * chaining as well | ||
| 48 | * | ||
| 49 | **/ | ||
| 50 | int sg_nents(struct scatterlist *sg) | ||
| 51 | { | ||
| 52 | int nents; | ||
| 53 | for (nents = 0; sg; sg = sg_next(sg)) | ||
| 54 | nents++; | ||
| 55 | return nents; | ||
| 56 | } | ||
| 57 | EXPORT_SYMBOL(sg_nents); | ||
| 58 | |||
| 59 | |||
| 60 | /** | ||
| 42 | * sg_last - return the last scatterlist entry in a list | 61 | * sg_last - return the last scatterlist entry in a list |
| 43 | * @sgl: First entry in the scatterlist | 62 | * @sgl: First entry in the scatterlist |
| 44 | * @nents: Number of entries in the scatterlist | 63 | * @nents: Number of entries in the scatterlist |
