 block: avoid possible overflow for chunk_sectors check in blk_stack_l… · gregkh/linux@46aa80e · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection  EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events &amp; webinars Ebooks &amp; reports Business insights GitHub Skills SUPPORT &amp; SERVICES Documentation Customer support Community forum Trust center Partners View all resources Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator GitHub Stars Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously.  Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gregkh / linux Public Notifications You must be signed in to change notification settings Fork 686 Star 644 Code Actions Security and quality 0 Insights Additional navigation options Code Actions Security and quality Insights Commit 46aa80e Browse files Browse files johnpgarry authored and gregkh committed block: avoid possible overflow for chunk_sectors check in blk_stack_limits() [ Upstream commit 448dfec ] In blk_stack_limits(), we check that the t-&gt;chunk_sectors value is a multiple of the t-&gt;physical_block_size value. However, by finding the chunk_sectors value in bytes, we may overflow the unsigned int which holds chunk_sectors, so change the check to be based on sectors. Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt; Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt; Signed-off-by: John Garry &lt;john.g.garry@oracle.com&gt; Reviewed-by: Damien Le Moal &lt;dlemoal@kernel.org&gt; Link: https://lore.kernel.org/r/20250729091448.1691334-2-john.g.garry@oracle.com Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt; Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt; 1 parent aaa447a commit 46aa80e Copy full SHA for 46aa80e 1 file changed + 1 - 1 Lines changed: 1 addition &amp; 1 deletion File tree Expand file tree Collapse file tree Open diff view settings Filter options block blk-settings.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ block/blk-settings.c ‎ Copy file name to clipboard Expand all lines: block/blk-settings.c + 1 - 1 Lines changed: 1 addition &amp; 1 deletion Original file line number Diff line number Diff line change @@ -623,7 +623,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 623 623 } 624 624 625 625 /* chunk_sectors a multiple of the physical block size? */ 626 - if ( ( t -&gt; chunk_sectors &lt;&lt; 9 ) &amp; ( t -&gt; physical_block_size - 1 )) { 626 + if ( t -&gt; chunk_sectors % ( t -&gt; physical_block_size &gt;&gt; SECTOR_SHIFT )) { 627 627 t -&gt; chunk_sectors = 0 ; 628 628 t -&gt; flags |= BLK_FLAG_MISALIGNED ; 629 629 ret = -1 ; 0 commit comments Comments 0 ( 0 ) Footer &copy; 2026 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. 