smem.c (04a512fea333369cc0b550f3b90df0d638e34d00) smem.c (8377f8181da8dce24ace68a43e280f6a6cb2c51c)
1/*
2 * Copyright (c) 2015, Sony Mobile Communications AB.
3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *

--- 361 unchanged lines hidden (view full) ---

370 if (le16_to_cpu(hdr->item) == item)
371 return -EEXIST;
372
373 hdr = uncached_entry_next(hdr);
374 }
375
376 /* Check that we don't grow into the cached region */
377 alloc_size = sizeof(*hdr) + ALIGN(size, 8);
1/*
2 * Copyright (c) 2015, Sony Mobile Communications AB.
3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *

--- 361 unchanged lines hidden (view full) ---

370 if (le16_to_cpu(hdr->item) == item)
371 return -EEXIST;
372
373 hdr = uncached_entry_next(hdr);
374 }
375
376 /* Check that we don't grow into the cached region */
377 alloc_size = sizeof(*hdr) + ALIGN(size, 8);
378 if ((void *)hdr + alloc_size >= cached) {
378 if ((void *)hdr + alloc_size > cached) {
379 dev_err(smem->dev, "Out of memory\n");
380 return -ENOSPC;
381 }
382
383 hdr->canary = SMEM_PRIVATE_CANARY;
384 hdr->item = cpu_to_le16(item);
385 hdr->size = cpu_to_le32(ALIGN(size, 8));
386 hdr->padding_data = cpu_to_le16(le32_to_cpu(hdr->size) - size);

--- 607 unchanged lines hidden ---
379 dev_err(smem->dev, "Out of memory\n");
380 return -ENOSPC;
381 }
382
383 hdr->canary = SMEM_PRIVATE_CANARY;
384 hdr->item = cpu_to_le16(item);
385 hdr->size = cpu_to_le32(ALIGN(size, 8));
386 hdr->padding_data = cpu_to_le16(le32_to_cpu(hdr->size) - size);

--- 607 unchanged lines hidden ---