pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 2+ messages / 2 participants [nested] [flat]
* BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 @ 2013-10-24 09:41 jmlich@redhat.com 2013-10-24 11:39 ` Re: BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 Haribabu kommi <haribabu.kommi@huawei.com> 0 siblings, 1 reply; 2+ messages in thread From: jmlich@redhat.com @ 2013-10-24 09:41 UTC (permalink / raw) To: pgsql-bugs The following bug has been logged on the website: Bug reference: 8552 Logged by: Jozef Mlich Email address: jmlich@redhat.com PostgreSQL version: 9.2.5 Operating system: any Description: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 Dear postgresql mainainers, I was testing the postgresql using coverity scan tool. It reports following problem: 1. postgresql-9.2.5/contrib/pageinspect/rawpage.c:81:negative_return_fn – Function "forkname_to_number(text_to_cstring(forkname))" returns a negative number. 15. postgresql-9.2.5/src/backend/catalog/catalog.c:79:2:return_negative_constant – Explicitly returning negative value "InvalidForkNumber". 16. postgresql-9.2.5/contrib/pageinspect/rawpage.c:81:var_assign – Assigning: signed variable "forknum" = "forkname_to_number(char *)". 17. postgresql-9.2.5/contrib/pageinspect/rawpage.c:83:negative_returns – Passing variable "forknum" to a parameter that cannot be negative. 30. postgresql-9.2.5/contrib/pageinspect/rawpage.c:146:2:index – Function "ReadBufferExtended(Relation, ForkNumber, BlockNumber, ReadBufferMode, BufferAccessStrategy)" uses "forknum" as an array index. 36. postgresql-9.2.5/src/backend/storage/buffer/bufmgr.c:248:2:index – Function "ReadBuffer_common(SMgrRelation, char, ForkNumber, BlockNumber, ReadBufferMode, BufferAccessStrategy, bool *)" uses "forkNum" as an array index. 51. postgresql-9.2.5/src/backend/storage/buffer/bufmgr.c:377:4:index – Function "relpathbackend(RelFileNode, BackendId, ForkNumber)" uses "forkNum" as an array index. 54. postgresql-9.2.5/src/backend/catalog/catalog.c:131:4:index – Indexing "forkNames" with "forknum". In my opinion it worth to fix. I am not sure how to do it as I am not very familiar with postgresql source code. I suggest to add assert into relpathbackend in calalog.c or to add condition into rawpage.c. In case it is not a bug, I would appreciate short explanation. (1) $ diff postgresql-9.2.5/src/backend/catalog/catalog.c.orig postgresql-9.2.5/src/backend/catalog/catalog.c 122a123,124 > Assert(forknum == InvalidForkNumber); > (2) $ diff postgresql-9.2.5/contrib/pageinspect/rawpage.c.orig postgresql-9.2.5/contrib/pageinspect/rawpage.c 82a83,87 > if (forknum == InvalidForkNumber) > { > foo() // FIXME > } > -- regards, Jozef Mlich -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 2013-10-24 09:41 BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 jmlich@redhat.com @ 2013-10-24 11:39 ` Haribabu kommi <haribabu.kommi@huawei.com> 0 siblings, 0 replies; 2+ messages in thread From: Haribabu kommi @ 2013-10-24 11:39 UTC (permalink / raw) To: jmlich@redhat.com <jmlich@redhat.com>; +Cc: pgsql-bugs On 24 October 2013 15:11 jmlich wrote: >NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 > >Dear postgresql mainainers, > >I was testing the postgresql using coverity scan tool. It reports following >problem: > > >1. postgresql-9.2.5/contrib/pageinspect/rawpage.c:81:negative_return_fn – Function "forkname_to_number(text_to_cstring(forkname))" returns a negative number. >15. >postgresql-9.2.5/src/backend/catalog/catalog.c:79:2:return_negative_constant >– Explicitly returning negative value "InvalidForkNumber". >16. postgresql-9.2.5/contrib/pageinspect/rawpage.c:81:var_assign – >Assigning: signed variable "forknum" = "forkname_to_number(char *)". >17. postgresql-9.2.5/contrib/pageinspect/rawpage.c:83:negative_returns – Passing variable "forknum" to a parameter that cannot be negative. >30. postgresql-9.2.5/contrib/pageinspect/rawpage.c:146:2:index – Function "ReadBufferExtended(Relation, ForkNumber, BlockNumber, ReadBufferMode, BufferAccessStrategy)" uses "forknum" as an array index. 36. postgresql-9.2.5/src/backend/storage/buffer/bufmgr.c:248:2:index – Function "ReadBuffer_common(SMgrRelation, char, ForkNumber, BlockNumber, ReadBufferMode, BufferAccessStrategy, bool *)" uses >"forkNum" as an array index. >51. postgresql-9.2.5/src/backend/storage/buffer/bufmgr.c:377:4:index – Function "relpathbackend(RelFileNode, BackendId, ForkNumber)" uses "forkNum" >as an array index. >54. postgresql-9.2.5/src/backend/catalog/catalog.c:131:4:index – Indexing "forkNames" with "forknum". > >In my opinion it worth to fix. I am not sure how to do it as I am not very familiar with postgresql source code. I suggest to add assert into relpathbackend in calalog.c or to add condition into >rawpage.c. In case it is not a bug, I would appreciate short explanation. The function forkname_to_number() doesn't return InvalidForkNumber. Before the return statement there is an ereport is present. The return statement is used for keeping the compiler quiet. The coverity tool is reporting the errors as it is not detecting the ereport. Regards, Hari Babu. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-10-24 11:39 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2013-10-24 09:41 BUG #8552: NEGATIVE_RETURNS in contrib/pageinspect/rawpage.c:83 jmlich@redhat.com 2013-10-24 11:39 ` Haribabu kommi <haribabu.kommi@huawei.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox