fslog.c (f3124d51e4e7b56a732419d8dc270e807252334f) | fslog.c (6ae7265a7b816879fd0203e83b5030d3720bbb7a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * 4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved. 5 * 6 */ 7 8#include <linux/blkdev.h> --- 710 unchanged lines hidden (view full) --- 719 u16 ne = le16_to_cpu(rt->used); 720 u32 ff = le32_to_cpu(rt->first_free); 721 u32 lf = le32_to_cpu(rt->last_free); 722 723 ts = rsize * ne + sizeof(struct RESTART_TABLE); 724 725 if (!rsize || rsize > bytes || 726 rsize + sizeof(struct RESTART_TABLE) > bytes || bytes < ts || | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * 4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved. 5 * 6 */ 7 8#include <linux/blkdev.h> --- 710 unchanged lines hidden (view full) --- 719 u16 ne = le16_to_cpu(rt->used); 720 u32 ff = le32_to_cpu(rt->first_free); 721 u32 lf = le32_to_cpu(rt->last_free); 722 723 ts = rsize * ne + sizeof(struct RESTART_TABLE); 724 725 if (!rsize || rsize > bytes || 726 rsize + sizeof(struct RESTART_TABLE) > bytes || bytes < ts || |
727 le16_to_cpu(rt->total) > ne || ff > ts || lf > ts || | 727 le16_to_cpu(rt->total) > ne || 728 ff > ts - sizeof(__le32) || lf > ts - sizeof(__le32) || |
728 (ff && ff < sizeof(struct RESTART_TABLE)) || 729 (lf && lf < sizeof(struct RESTART_TABLE))) { 730 return false; 731 } 732 733 /* 734 * Verify each entry is either allocated or points 735 * to a valid offset the table. --- 13 unchanged lines hidden (view full) --- 749 * Walk through the list headed by the first entry to make 750 * sure none of the entries are currently being used. 751 */ 752 for (off = ff; off;) { 753 if (off == RESTART_ENTRY_ALLOCATED) 754 return false; 755 756 off = le32_to_cpu(*(__le32 *)Add2Ptr(rt, off)); | 729 (ff && ff < sizeof(struct RESTART_TABLE)) || 730 (lf && lf < sizeof(struct RESTART_TABLE))) { 731 return false; 732 } 733 734 /* 735 * Verify each entry is either allocated or points 736 * to a valid offset the table. --- 13 unchanged lines hidden (view full) --- 750 * Walk through the list headed by the first entry to make 751 * sure none of the entries are currently being used. 752 */ 753 for (off = ff; off;) { 754 if (off == RESTART_ENTRY_ALLOCATED) 755 return false; 756 757 off = le32_to_cpu(*(__le32 *)Add2Ptr(rt, off)); |
758 759 if (off > ts - sizeof(__le32)) 760 return false; |
|
757 } 758 759 return true; 760} 761 762/* 763 * free_rsttbl_idx - Free a previously allocated index a Restart Table. 764 */ --- 4451 unchanged lines hidden --- | 761 } 762 763 return true; 764} 765 766/* 767 * free_rsttbl_idx - Free a previously allocated index a Restart Table. 768 */ --- 4451 unchanged lines hidden --- |